From b07d929484240a37780fd6bc457e4ed6877889a0 Mon Sep 17 00:00:00 2001 From: Kim Biesbjerg Date: Sun, 22 Mar 2020 11:13:16 +0100 Subject: [PATCH] Add more tests --- tests/parsers/directive.parser.spec.ts | 6 ++++++ tests/parsers/marker.parser.spec.ts | 16 ++++++++++++++++ 2 files changed, 22 insertions(+) diff --git a/tests/parsers/directive.parser.spec.ts b/tests/parsers/directive.parser.spec.ts index bc1b9fc..8dab05e 100644 --- a/tests/parsers/directive.parser.spec.ts +++ b/tests/parsers/directive.parser.spec.ts @@ -107,4 +107,10 @@ describe('DirectiveParser', () => { const keys = parser.extract(contents, templateFilename).keys(); expect(keys).to.deep.equal(['There are currently no students in this class. The good news is, adding students is really easy! Just use the options at the top.']); }); + + it('should extract contents without indent spaces', () => { + const contents = ``; + const keys = parser.extract(contents, templateFilename).keys(); + expect(keys).to.deep.equal(['client.search.searchBtn']); + }); }); diff --git a/tests/parsers/marker.parser.spec.ts b/tests/parsers/marker.parser.spec.ts index 8e34475..5270575 100644 --- a/tests/parsers/marker.parser.spec.ts +++ b/tests/parsers/marker.parser.spec.ts @@ -35,4 +35,20 @@ describe('MarkerParser', () => { const keys = parser.extract(contents, componentFilename).keys(); expect(keys).to.deep.equal(['Hello world', 'This is a very very very very long line.', 'Mix of different types']); }); + + it('should extract the strings', () => { + const contents = ` + import { marker } from '@biesbjerg/ngx-translate-extract-marker'; + + export class AppModule { + constructor() { + marker('DYNAMIC_TRAD.val1'); + marker('DYNAMIC_TRAD.val2'); + } + } + `; + const keys = parser.extract(contents, componentFilename).keys(); + expect(keys).to.deep.equal(['DYNAMIC_TRAD.val1', 'DYNAMIC_TRAD.val2']); + }); + });