added pipe tests

This commit is contained in:
Nicolas Constant 2020-05-21 01:07:23 -04:00
parent f4ff3d0e94
commit 93a0d17fc0
No known key found for this signature in database
GPG Key ID: 1E9F677FB01A5688
1 changed files with 28 additions and 4 deletions

View File

@ -1,8 +1,32 @@
import { EnsureHttpsPipe } from './ensure-https.pipe';
describe('EnsureHttpsPipe', () => {
it('create an instance', () => {
const pipe = new EnsureHttpsPipe();
expect(pipe).toBeTruthy();
});
it('create an instance', () => {
const pipe = new EnsureHttpsPipe();
expect(pipe).toBeTruthy();
});
it('support null value', () => {
const val = null;
const pipe = new EnsureHttpsPipe();
const result = pipe.transform(val);
expect(result).toBe(null);
});
it('support not transform https://', () => {
const val = 'https://my-link.com';
const pipe = new EnsureHttpsPipe();
const result = pipe.transform(val);
expect(result).toBe(val);
});
it('support transform http:// to https://', () => {
const val = 'http://my-link.com';
const pipe = new EnsureHttpsPipe();
const result = pipe.transform(val);
expect(result).toBe('https://my-link.com');
});
});