2023-07-17 15:29:56 -05:00
|
|
|
import { loadFixture, readXML } from './test-utils.js';
|
|
|
|
import { expect } from 'chai';
|
|
|
|
|
|
|
|
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 () => {
|
|
|
|
expect(urls).to.not.include('http://example.com/endpoint.json');
|
|
|
|
});
|
|
|
|
|
2023-07-17 15:32:14 -05:00
|
|
|
it('does not include redirects', async () => {
|
2023-07-17 15:29:56 -05:00
|
|
|
expect(urls).to.not.include('http://example.com/redirect');
|
|
|
|
});
|
|
|
|
});
|