-
-
Save AlexLakatos/5c69ff07710ca5b2776d9ad491332c65 to your computer and use it in GitHub Desktop.
capitalisePipe.spec.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| describe('Pipe: CapitalisePipe', () => { | |
| let pipe; | |
| //setup | |
| beforeEach(() => TestBed.configureTestingModule({ | |
| providers: [ CapitalisePipe ] | |
| })); | |
| beforeEach(inject([CapitalisePipe], p => { | |
| pipe = p; | |
| })); | |
| //specs | |
| it('should work with empty string', () => { | |
| expect(pipe.transform('')).toEqual(''); | |
| }); | |
| it('should capitalise', () => { | |
| expect(pipe.transform('wow')).toEqual('WOW'); | |
| }); | |
| it('should throw with invalid values', () => { | |
| //must use arrow function for expect to capture exception | |
| expect(()=>pipe.transform(undefined)).toThrow(); | |
| expect(()=>pipe.transform()).toThrow(); | |
| expect(()=>pipe.transform()).toThrowError('Requires a String as input'); | |
| }); | |
| }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment