2e14873f2d
Track application source and tests; exclude local env, user workspaces, and runtime data via .gitignore. Co-authored-by: Cursor <cursoragent@cursor.com>
16 lines
677 B
JavaScript
16 lines
677 B
JavaScript
import assert from 'node:assert/strict';
|
|
import test from 'node:test';
|
|
import { localizeGoogleFontsCss } from './mindspace-html-localize.mjs';
|
|
|
|
test('localizeGoogleFontsCss inlines google fonts imports', async () => {
|
|
const source = `<!doctype html><html><head><style>
|
|
@import url('https://fonts.googleapis.com/css2?family=Noto+Sans+SC&display=swap');
|
|
body { color: red; }
|
|
</style></head><body>Hi</body></html>`;
|
|
|
|
const result = await localizeGoogleFontsCss(source);
|
|
assert.equal(result.localizedCount, 1);
|
|
assert.match(result.html, /data-mindspace-local="google-fonts"/);
|
|
assert.doesNotMatch(result.html, /@import\s+url\(['"]?https:\/\/fonts\.googleapis\.com/);
|
|
});
|