Skip to content

Commit

Permalink
test: object tests
Browse files Browse the repository at this point in the history
  • Loading branch information
arthurfiorette committed Nov 3, 2023
1 parent 83ca248 commit 2a1befc
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,22 @@ test('array usage', () => {
});
});

test('object usage', () => {
const file = ts`${'object'}${{ z: 1, a: 2 }}`;

assert.deepStrictEqual(file, {
source: {
filename: 'object.js',
// 'json-stable-stringify' sorts the keys to keep a consistent output.
content: '{\n "a": 2,\n "z": 1\n}'
},
types: {
filename: 'object.d.ts',
content: ''
}
});
});

test('join usage', () => {
assert.equal(ts.join([1, 2, 3]), '1\n2\n3');
assert.equal(ts.join([1, 2, 3], ' '), '1 2 3');
Expand Down

0 comments on commit 2a1befc

Please sign in to comment.