HH-530: replace user-facing Chatwoot branding with GoChat (#117)
* fix(HH-530): replace user-facing Chatwoot branding * fix(HH-530): close branding review blockers * test(HH-530): cover update banner binding --------- Co-authored-by: Rogee <rogee@ipao.vip>
This commit is contained in:
@@ -10,9 +10,16 @@ const html = readFileSync(
|
||||
const assets = [...html.matchAll(/(?:href|src)="(\/assets\/[^"]+)"/g)].map(
|
||||
match => match[1]
|
||||
);
|
||||
const manifest = JSON.parse(
|
||||
readFileSync(new URL('../dist/manifest.json', import.meta.url), 'utf8')
|
||||
);
|
||||
|
||||
assert.match(html, /<div id="app"><\/div>/);
|
||||
assert.match(html, /<script\s+src="\/runtime-config\.js"><\/script>/);
|
||||
assert.match(html, /<link\s+rel="manifest"\s+href="\/manifest\.json"\s*\/?>/);
|
||||
assert.match(
|
||||
html,
|
||||
/<script\b[^>]*\bsrc="\/runtime-config\.js"[^>]*><\/script>/
|
||||
);
|
||||
assert.ok(
|
||||
html.indexOf('/runtime-config.js') < html.indexOf('type="module"'),
|
||||
'runtime config must load before the app module'
|
||||
@@ -28,6 +35,20 @@ assert.ok(
|
||||
assert.ok(!/<script(?![^>]*\bsrc=)[^>]*>/i.test(html), 'inline script found');
|
||||
assets.forEach(asset => assert.ok(existsSync(dist + asset.slice(1)), asset));
|
||||
|
||||
for (const size of [192, 512]) {
|
||||
const dimensions = `${size}x${size}`;
|
||||
const icon = manifest.icons.find(item => item.sizes === dimensions);
|
||||
assert.equal(icon?.type, 'image/png', `missing ${dimensions} PNG icon`);
|
||||
|
||||
const png = readFileSync(dist + icon.src.slice(1));
|
||||
assert.deepEqual(
|
||||
[...png.subarray(0, 8)],
|
||||
[137, 80, 78, 71, 13, 10, 26, 10]
|
||||
);
|
||||
assert.equal(png.readUInt32BE(16), size, `${icon.src} width`);
|
||||
assert.equal(png.readUInt32BE(20), size, `${icon.src} height`);
|
||||
}
|
||||
|
||||
const dashboard = assets
|
||||
.filter(asset => asset.endsWith('.js'))
|
||||
.map(asset => readFileSync(dist + asset.slice(1), 'utf8'))
|
||||
|
||||
Reference in New Issue
Block a user