23 lines
852 B
JavaScript
23 lines
852 B
JavaScript
import assert from 'node:assert/strict';
|
|
import fs from 'node:fs/promises';
|
|
import path from 'node:path';
|
|
import test from 'node:test';
|
|
|
|
const root = path.resolve(import.meta.dirname, '..');
|
|
|
|
async function read(relativePath) {
|
|
return fs.readFile(path.join(root, relativePath), 'utf8');
|
|
}
|
|
|
|
test('start page keeps nearby recommendations and the complete route list', async () => {
|
|
const html = await read('public/index.html');
|
|
const app = await read('public/js/app.js');
|
|
|
|
assert.match(html, /id="nearby-route-list"/);
|
|
assert.match(html, /id="all-route-list"/);
|
|
assert.match(html, /id="route-search"/);
|
|
assert.match(app, /renderRouteItems\('#nearby-route-list'/);
|
|
assert.match(app, /renderRouteItems\(\s*'#all-route-list'/);
|
|
assert.doesNotMatch(app, /state\.routes\s*=\s*state\.routes[\s\S]*?\.filter\(route => route\.proximityM/);
|
|
});
|