Skip to content

Commit

Permalink
split test cases to separate its
Browse files Browse the repository at this point in the history
  • Loading branch information
pazhersh committed May 22, 2024
1 parent 116ecb6 commit 2e43454
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion test/template.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,13 +117,18 @@ describe('template', () => {
expect(result).toBe("https://some.random.url?str=bar&num=1&bool=true&null=null&arr=[\"foo\"]&obj={\"bar\":\"bar\"}");
});
it('testing conditional key', () => {
const json = { foo: "bar" };
const json = {};
const render = (input) => jq.renderRecursively(json, input);

expect(render({'{{empty}}': 'bar'})).toEqual({});
expect(render({'{{null}}': 'bar'})).toEqual({});
expect(render({'{{""}}': 'bar'})).toEqual({});
expect(render({'{{\'\'}}': 'bar'})).toEqual({});
});
it('testing spread key', () => {
const json = { foo: "bar" };
const render = (input) => jq.renderRecursively(json, input);

expect(render({ "{{spreadValue()}}": { foo: "bar" } })).toEqual({foo: "bar"});
expect(render({ " {{ spreadValue( ) }} ": { foo: "bar" } })).toEqual({foo: "bar"});
expect(render({ "{{spreadValue()}}": "{{ . }}" })).toEqual({ foo: "bar" });
Expand Down

0 comments on commit 2e43454

Please sign in to comment.