2024-01-31 04:47:33 -05:00
|
|
|
import assert from 'node:assert/strict';
|
|
|
|
import { before, describe, it } from 'node:test';
|
2023-07-17 15:29:56 -05:00
|
|
|
import { loadFixture, readXML } from './test-utils.js';
|
|
|
|
|
|
|
|
describe('routes', () => {
|
|
|
|
/** @type {import('./test-utils.js').Fixture} */
|
|
|
|
let fixture;
|
2023-07-17 15:32:14 -05:00
|
|
|
/** @type {string[]} */
|
|
|
|
let urls;
|
2023-07-17 15:29:56 -05:00
|
|
|
|
|
|
|
before(async () => {
|
|
|
|
fixture = await loadFixture({
|
|
|
|
root: './fixtures/static/',
|
|
|
|
});
|
|
|
|
await fixture.build();
|
2023-07-17 15:32:14 -05:00
|
|
|
const data = await readXML(fixture.readFile('/sitemap-0.xml'));
|
|
|
|
urls = data.urlset.url.map((url) => url.loc[0]);
|
2023-07-17 15:29:56 -05:00
|
|
|
});
|
|
|
|
|
|
|
|
it('does not include endpoints', async () => {
|
2024-01-31 04:47:33 -05:00
|
|
|
assert.equal(urls.includes('http://example.com/endpoint.json'), false);
|
2023-07-17 15:29:56 -05:00
|
|
|
});
|
|
|
|
|
2023-07-17 15:32:14 -05:00
|
|
|
it('does not include redirects', async () => {
|
2024-01-31 04:47:33 -05:00
|
|
|
assert.equal(urls.includes('http://example.com/redirect'), false);
|
2023-07-17 15:29:56 -05:00
|
|
|
});
|
|
|
|
});
|