29 lines
1.3 KiB
JavaScript
29 lines
1.3 KiB
JavaScript
const assert = require('node:assert/strict');
|
|
const fs = require('node:fs');
|
|
const path = require('node:path');
|
|
const test = require('node:test');
|
|
|
|
const page = fs.readFileSync(path.join(__dirname, '..', 'index.html'), 'utf8');
|
|
|
|
test('local AI adapter comes from the static service and starts after authenticated game entry', () => {
|
|
assert.match(page, /<script src="\/static\/wllama-gemma3-v1\/local-ai\.js"><\/script>/);
|
|
assert.match(page, /showPlay\(\);\s*if \(!currentAccount\.is_admin\) window\.localGameAI\?\.start\(currentAccount\.id\)/);
|
|
});
|
|
|
|
test('Gemma license links are shown in the accessible game dialogue and consent can be withdrawn', () => {
|
|
assert.match(page, /type === 'terms-required'/);
|
|
assert.match(page, /Gemma-villkor/);
|
|
assert.match(page, /Spelvillkor för Gemma/);
|
|
assert.match(page, /policy för förbjuden användning/);
|
|
assert.match(page, /lokal ai godkänn villkor/);
|
|
assert.match(page, /lokal ai avvisa villkor/);
|
|
assert.match(page, /window\.localGameAI\?\.stop\(\)/);
|
|
});
|
|
|
|
test('local assistance remains advisory and preserves the normal dialogue request path', () => {
|
|
assert.match(page, /client_assistance: clientAssistance/);
|
|
assert.match(page, /Local assistance is optional; the original input always proceeds/);
|
|
assert.match(page, /request\('\/api\/dialogue'/);
|
|
assert.match(page, /Lokalt, osparat förslag:/);
|
|
});
|