chore(wallaby.js): fix test issues

This commit is contained in:
Mikhail Bashkirov 2019-05-08 08:06:33 +02:00 committed by Thomas Allmer
parent f0046ef1d7
commit b2cfb7bfc3
4 changed files with 16 additions and 9 deletions

View file

@ -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,

View file

@ -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);

View 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);
}
};

View file

@ -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', () => {