32 lines
1.1 KiB
TypeScript
32 lines
1.1 KiB
TypeScript
import { createHash } from 'node:crypto';
|
|
import { readFileSync } from 'node:fs';
|
|
import { resolve } from 'node:path';
|
|
import { describe, expect, it } from 'vitest';
|
|
import { BUNDLED_CONTACT_SHEET_FONT } from '../../src/assets/bundled-font';
|
|
|
|
describe('bundled contact-sheet font', () => {
|
|
it('matches its reviewed byte identity and ships the embedded licence', () => {
|
|
const bytes = readFileSync(
|
|
resolve(
|
|
process.cwd(),
|
|
'public/fonts',
|
|
BUNDLED_CONTACT_SHEET_FONT.fileName
|
|
)
|
|
);
|
|
expect(bytes.byteLength).toBe(BUNDLED_CONTACT_SHEET_FONT.byteLength);
|
|
expect(createHash('sha256').update(bytes).digest('hex')).toBe(
|
|
BUNDLED_CONTACT_SHEET_FONT.sha256
|
|
);
|
|
|
|
const licence = readFileSync(
|
|
resolve(process.cwd(), BUNDLED_CONTACT_SHEET_FONT.licenseFile),
|
|
'utf8'
|
|
);
|
|
expect(licence).toContain('Bitstream Vera Fonts Copyright');
|
|
expect(licence).toContain('Arev Fonts Copyright');
|
|
expect(licence).toContain(
|
|
'The above copyright and trademark notices and this permission notice'
|
|
);
|
|
});
|
|
});
|