Skip to content

Commit

Permalink
Use '0', not 'null'
Browse files Browse the repository at this point in the history
  • Loading branch information
tancredi committed Feb 8, 2021
1 parent ad45ea8 commit ea4ad73
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 4 deletions.
6 changes: 3 additions & 3 deletions src/generators/asset-types/__tests__/ttf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,17 @@ describe('`TTF` font generator', () => {

expect(svg2ttf).toHaveBeenCalledTimes(1);
expect(svg2ttf).toHaveBeenCalledWith(svg, {
ts: null,
ts: 0,
__mock: 'options__'
});
expect(result).toEqual(Buffer.from(`::ttf(${svg})::`));
});

test('passes correctly format options to `svg2ttf` and sets `ts` (timestamp) to `null` by default to avoid generating unnecessary diffs', async () => {
test('passes correctly format options to `svg2ttf` and sets `ts` (timestamp) to `0` by default to avoid generating unnecessary diffs', async () => {
const formatOptions = { foo: 'bar' };
await ttfGen.generate(mockOptions(formatOptions), svg);

expect(svg2ttf).toHaveBeenCalledTimes(1);
expect(svg2ttf.mock.calls[0][1]).toEqual({ ts: null, ...formatOptions });
expect(svg2ttf.mock.calls[0][1]).toEqual({ ts: 0, ...formatOptions });
});
});
2 changes: 1 addition & 1 deletion src/generators/asset-types/ttf.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ const generator: FontGenerator<string> = {
dependsOn: FontAssetType.SVG,

async generate({ formatOptions }, svg) {
const font = svg2ttf(svg, { ts: null, ...(formatOptions?.ttf || {}) });
const font = svg2ttf(svg, { ts: 0, ...(formatOptions?.ttf || {}) });
return Buffer.from(font.buffer);
}
};
Expand Down

0 comments on commit ea4ad73

Please sign in to comment.