mirror of
https://github.com/elastic/kibana.git
synced 2025-06-29 11:33:47 -04:00
Object versioning package (#153182)
This commit is contained in:
parent
340ee10086
commit
e8a20bb258
40 changed files with 1949 additions and 12 deletions
32
packages/kbn-object-versioning/lib/utils.test.ts
Normal file
32
packages/kbn-object-versioning/lib/utils.test.ts
Normal file
|
@ -0,0 +1,32 @@
|
|||
/*
|
||||
* Copyright Elasticsearch B.V. and/or licensed to Elasticsearch B.V. under one
|
||||
* or more contributor license agreements. Licensed under the Elastic License
|
||||
* 2.0 and the Server Side Public License, v 1; you may not use this file except
|
||||
* in compliance with, at your election, the Elastic License 2.0 or the Server
|
||||
* Side Public License, v 1.
|
||||
*/
|
||||
|
||||
import { validateVersion } from './utils';
|
||||
|
||||
describe('utils', () => {
|
||||
describe('validateVersion()', () => {
|
||||
[
|
||||
{ input: '123', isValid: true, expected: 123 },
|
||||
{ input: 123, isValid: true, expected: 123 },
|
||||
{ input: 1.23, isValid: false, expected: null },
|
||||
{ input: '123a', isValid: false, expected: null },
|
||||
{ input: 'abc', isValid: false, expected: null },
|
||||
{ input: undefined, isValid: false, expected: null },
|
||||
{ input: null, isValid: false, expected: null },
|
||||
{ input: [123], isValid: false, expected: null },
|
||||
{ input: { 123: true }, isValid: false, expected: null },
|
||||
{ input: () => 123, isValid: false, expected: null },
|
||||
].forEach(({ input, expected, isValid }) => {
|
||||
test(`validate: [${input}]`, () => {
|
||||
const { result, value } = validateVersion(input);
|
||||
expect(result).toBe(isValid);
|
||||
expect(value).toBe(expected);
|
||||
});
|
||||
});
|
||||
});
|
||||
});
|
Loading…
Add table
Add a link
Reference in a new issue