From 85a1d04c96ffbf61c59648acf9057ce032778267 Mon Sep 17 00:00:00 2001 From: Kim Biesbjerg Date: Thu, 8 Dec 2016 14:12:43 +0100 Subject: [PATCH] Add tests for PipeParser --- tests/pipe.parser.spec.ts | 33 +++++++++++++++++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 tests/pipe.parser.spec.ts diff --git a/tests/pipe.parser.spec.ts b/tests/pipe.parser.spec.ts new file mode 100644 index 0000000..26ecd0d --- /dev/null +++ b/tests/pipe.parser.spec.ts @@ -0,0 +1,33 @@ +import { expect } from 'chai'; + +import { PipeParser } from '../src/parsers/pipe.parser'; + +describe('PipeParser', () => { + + const templateFilename: string = 'test.template.html'; + + let parser: PipeParser; + + beforeEach(() => { + parser = new PipeParser(); + }); + + it('should extract interpolated strings using translate pipe', () => { + const contents = `Hello {{ 'World' | translate }}`; + const messages = parser.process(templateFilename, contents); + expect(messages).to.deep.equal(['World']); + }); + + it('should extract interpolated strings using translate pipe in attributes', () => { + const contents = ``; + const messages = parser.process(templateFilename, contents); + expect(messages).to.deep.equal(['Hello World']); + }); + + it('should extract bound strings using translate pipe in attributes', () => { + const contents = ``; + const messages = parser.process(templateFilename, contents); + expect(messages).to.deep.equal(['Hello World']); + }); + +});