Skip to content

Commit 546b34b

Browse files
test(Variable): remove tests for accessor variable, change the variable to valueOf(), change the method name replaceVariable() to replaceVariableIn(), fix test of toString() method by replacing the variable to proper method.
1 parent f4026d7 commit 546b34b

File tree

1 file changed

+11
-19
lines changed

1 file changed

+11
-19
lines changed

src/tag/variable/test/variable.spec.ts

Lines changed: 11 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -24,14 +24,6 @@ testing.describe(`Variable`, () => {
2424

2525
expect(variableFix.value).toBeUndefined();
2626
toBe.undefined(variableFix.value);
27-
})
28-
29-
.it(`Variable.prototype.variable`, () => {
30-
expect(variableProblem.variable).toEqual(`{${problem}}`);
31-
toBe.stringIncludes(variableProblem.variable, [`{${problem}}`, problem]);
32-
33-
expect(variableFix.variable).toEqual(`{${fix}}`);
34-
toBe.stringIncludes(variableFix.variable, [fix, `{${fix}}`]);
3527
});
3628

3729
})
@@ -40,10 +32,10 @@ testing.describe(`Variable`, () => {
4032
testing
4133

4234
.it(`Variable.define()`, () => {
43-
expect(Variable.define(problem, value).variable).toEqual(`{${problem}}`);
35+
expect(Variable.define(problem, value).valueOf()).toEqual(`{${problem}}`);
4436
expect(Variable.define(problem, value).value).toEqual(value);
4537

46-
expect(Variable.define(fix).variable).toEqual(`{${fix}}`);
38+
expect(Variable.define(fix).valueOf()).toEqual(`{${fix}}`);
4739
expect(Variable.define(fix).getValue()).toBeUndefined();
4840
expect(Variable.define(fix).value).toBeUndefined();
4941
})
@@ -71,16 +63,16 @@ testing.describe(`Variable`, () => {
7163
})
7264

7365
.it(`Variable.prototype.replaceVariable()`, () => {
74-
expect(variableProblem.replaceVariable(text))
66+
expect(variableProblem.replaceVariableIn(text))
7567
.toEqual('{id} There is a problem with my {fix} and we cannot repair it.');
76-
expect(variableProblem.replaceVariable(text, 'Custom text' as any))
68+
expect(variableProblem.replaceVariableIn(text, 'Custom text' as any))
7769
.toEqual('{id} Custom text with my {fix} and we cannot repair it.');
78-
expect(new Variable('problem').replaceVariable(text, 'There is not a problem'))
70+
expect(new Variable('problem').replaceVariableIn(text, 'There is not a problem'))
7971
.toEqual('{id} There is not a problem with my {fix} and we cannot repair it.');
8072

81-
expect(variableFix.replaceVariable(text))
73+
expect(variableFix.replaceVariableIn(text))
8274
.toEqual('{id} {problem} with my and we cannot repair it.');
83-
expect(variableFix.replaceVariable(text, 'fix ooouuch'))
75+
expect(variableFix.replaceVariableIn(text, 'fix ooouuch'))
8476
.toEqual('{id} {problem} with my fix ooouuch and we cannot repair it.');
8577
})
8678

@@ -95,11 +87,11 @@ testing.describe(`Variable`, () => {
9587
})
9688

9789
.it(`Variable.prototype.toString()`, () => {
98-
expect(variableProblem.variable).toEqual(`{${problem}}`);
99-
toBe.stringIncludes(variableProblem.variable, [`{${problem}}`, problem]);
90+
expect(variableProblem.toString()).toEqual(`{${problem}}`);
91+
toBe.stringIncludes(variableProblem.toString(), [`{${problem}}`, problem]);
10092

101-
expect(variableFix.variable).toEqual(`{${fix}}`);
102-
toBe.stringIncludes(variableFix.variable, [`{${fix}}`, fix]);
93+
expect(variableFix.toString()).toEqual(`{${fix}}`);
94+
toBe.stringIncludes(variableFix.toString(), [`{${fix}}`, fix]);
10395
})
10496

10597
.it(`Variable.prototype.valueOf()`, () => {

0 commit comments

Comments
 (0)