smartvalidator/test/test.both.ts

25 lines
726 B
TypeScript
Raw Normal View History

2022-07-08 09:55:25 +00:00
import { expect, expectAsync, tap } from '@pushrocks/tapbundle';
import * as smartvalidator from '../ts/index.js';
let testValidator: smartvalidator.SmartValidator;
tap.test('first test', async () => {
testValidator = new smartvalidator.SmartValidator();
expect(testValidator).toBeInstanceOf(smartvalidator.SmartValidator);
});
2023-03-27 21:13:37 +00:00
tap.test('should check for being a URL', async () => {
expect(testValidator.isUrl('lossless.com')).toBeTrue();
})
2022-07-08 09:55:25 +00:00
tap.test('should check an IBAN', async () => {
expect(testValidator.isIban('AT95 0100 0000 0555 4915')).toBeTrue();
2022-07-08 10:31:44 +00:00
});
tap.test('escape email', async () => {
const escapedEmail = testValidator.escape('test@example.com');
console.log(escapedEmail);
2023-03-27 21:13:37 +00:00
});
2022-07-08 09:55:25 +00:00
tap.start();