chore(wallaby.js): fix test issues
This commit is contained in:
parent
f0046ef1d7
commit
b2cfb7bfc3
4 changed files with 16 additions and 9 deletions
|
|
@ -1,5 +1,5 @@
|
|||
import { expect } from '@open-wc/testing';
|
||||
import { smokeTestValidator } from '@lion/validate/test/validators.test.js';
|
||||
import { smokeTestValidator } from '@lion/validate/test/test-utils.js';
|
||||
|
||||
import {
|
||||
isIBAN,
|
||||
|
|
|
|||
|
|
@ -1,4 +1,5 @@
|
|||
import { expect } from '@open-wc/testing';
|
||||
import { localizeTearDown } from '../../test-helpers.js';
|
||||
|
||||
import { parseDate } from '../../src/date/parseDate.js';
|
||||
|
||||
|
|
@ -12,6 +13,10 @@ function equalsDate(value, date) {
|
|||
}
|
||||
|
||||
describe('parseDate()', () => {
|
||||
beforeEach(() => {
|
||||
localizeTearDown();
|
||||
});
|
||||
|
||||
it('adds leading zeros', () => {
|
||||
expect(equalsDate(parseDate('1-1-1979'), new Date('1979/01/01'))).to.equal(true);
|
||||
expect(equalsDate(parseDate('1-11-1979'), new Date('1979/11/01'))).to.equal(true);
|
||||
|
|
|
|||
9
packages/validate/test/test-utils.js
Normal file
9
packages/validate/test/test-utils.js
Normal file
|
|
@ -0,0 +1,9 @@
|
|||
import { expect } from '@open-wc/testing';
|
||||
|
||||
export const smokeTestValidator = (name, validator, value, params = undefined) => {
|
||||
const generated = validator(params);
|
||||
expect(generated[0](value, params)[name]).to.be.true;
|
||||
if (params) {
|
||||
expect(generated[1]).to.equals(params);
|
||||
}
|
||||
};
|
||||
|
|
@ -1,4 +1,5 @@
|
|||
import { expect } from '@open-wc/testing';
|
||||
import { smokeTestValidator } from './test-utils.js';
|
||||
|
||||
import {
|
||||
isString,
|
||||
|
|
@ -35,14 +36,6 @@ import {
|
|||
defaultOkValidator,
|
||||
} from '../src/validators.js';
|
||||
|
||||
export const smokeTestValidator = (name, validator, value, params = undefined) => {
|
||||
const generated = validator(params);
|
||||
expect(generated[0](value, params)[name]).to.be.true;
|
||||
if (params) {
|
||||
expect(generated[1]).to.equals(params);
|
||||
}
|
||||
};
|
||||
|
||||
describe('LionValidate', () => {
|
||||
describe('String Validation', () => {
|
||||
it('provides isString() to allow only strings', () => {
|
||||
|
|
|
|||
Loading…
Reference in a new issue