Skip to content

Commit f35d22f

Browse files
committed
fix(#621) fix after rebase
1 parent 33ab971 commit f35d22f

File tree

2 files changed

+16
-2
lines changed

2 files changed

+16
-2
lines changed

libs/transloco-validator/src/lib/transloco-validator.spec.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ describe('transloco-validator', () => {
2323
jest.mocked(fs.readFileSync).mockImplementation(() => '{"test":{"erreur"}}');
2424

2525
const callValidator = () => validator('', ['mytest.json']);
26-
expect(callValidator).toThrowError(new SyntaxError("Unexpected token } in JSON at position 17 (mytest.json)"));
26+
expect(callValidator).toThrowError(new SyntaxError("Expected ':' after property name in JSON at position 17 (mytest.json)"));
2727
})
2828

2929
it('should return success', () => {

libs/transloco/src/lib/tests/transpiler.spec.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -123,12 +123,26 @@ describe('TranslocoTranspiler', () => {
123123

124124
function testDefaultBehaviour(
125125
parser: TranslocoTranspiler,
126-
[start, end]: [string, string] = defaultConfig.interpolation
126+
[start, end, forbiddenChars]: [string, string, string?] = defaultConfig.interpolation
127127
) {
128128
function wrapParam(param: string) {
129129
return `${start} ${param} ${end}`;
130130
}
131131

132+
it('should skip if forbidden chars are used', () => {
133+
if (forbiddenChars?.length) {
134+
for (const char of forbiddenChars) {
135+
const parsed = parser.transpile(
136+
`Hello ${wrapParam('value ' + char)}`,
137+
{ value: 'World' },
138+
{},
139+
'key'
140+
);
141+
expect(parsed).toEqual(`Hello ${wrapParam('value ' + char)}`);
142+
}
143+
}
144+
});
145+
132146
it('should translate simple string from params', () => {
133147
const parsed = parser.transpile(
134148
`Hello ${wrapParam('value')}`,

0 commit comments

Comments
 (0)