Skip to content

Commit d2c4062

Browse files
author
keindev
committed
test: add string with escaped braces
1 parent 00985d8 commit d2c4062

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/__tests__/Theme.test.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ import stripAnsi from 'strip-ansi';
44
import { IndicationBadge, IndicationType, Theme } from '../Theme';
55

66
describe('Theme', (): void => {
7-
const text = 'text';
7+
const text = { input: '\\{\\{\\{t\\}e\\}x{red t}\\}', output: '{{{t}e}xt}' };
88

99
it('Default', (): void => {
1010
const theme = new Theme();
1111

12-
expect(stripAnsi(theme.paint(text, IndicationType.Default))).toBe(text);
13-
expect(stripAnsi(theme.paint(text, IndicationType.Success))).toBe(text);
14-
expect(stripAnsi(theme.paint(text, IndicationType.Skip))).toBe(text);
15-
expect(stripAnsi(theme.paint(text, IndicationType.Error))).toBe(text);
12+
expect(stripAnsi(theme.paint(text.input, IndicationType.Default))).toBe(text.output);
13+
expect(stripAnsi(theme.paint(text.input, IndicationType.Success))).toBe(text.output);
14+
expect(stripAnsi(theme.paint(text.input, IndicationType.Skip))).toBe(text.output);
15+
expect(stripAnsi(theme.paint(text.input, IndicationType.Error))).toBe(text.output);
1616

1717
expect(stripAnsi(theme.symbol(IndicationType.Default))).toBe(stripAnsi(figures.pointerSmall));
1818
expect(stripAnsi(theme.symbol(IndicationType.Success))).toBe(stripAnsi(figures.tick));
@@ -34,10 +34,10 @@ describe('Theme', (): void => {
3434
error: { symbol, badge },
3535
});
3636

37-
expect(stripAnsi(theme.paint(text, IndicationType.Default))).toBe(text);
38-
expect(stripAnsi(theme.paint(text, IndicationType.Success))).toBe(text);
39-
expect(stripAnsi(theme.paint(text, IndicationType.Skip))).toBe(text);
40-
expect(stripAnsi(theme.paint(text, IndicationType.Error))).toBe(text);
37+
expect(stripAnsi(theme.paint(text.input, IndicationType.Default))).toBe(text.output);
38+
expect(stripAnsi(theme.paint(text.input, IndicationType.Success))).toBe(text.output);
39+
expect(stripAnsi(theme.paint(text.input, IndicationType.Skip))).toBe(text.output);
40+
expect(stripAnsi(theme.paint(text.input, IndicationType.Error))).toBe(text.output);
4141

4242
expect(stripAnsi(theme.symbol(IndicationType.Default))).toBe(symbol);
4343
expect(stripAnsi(theme.symbol(IndicationType.Success))).toBe(symbol);

0 commit comments

Comments
 (0)