routes.test.js 769 B

123456789101112131415161718192021222324252627
  1. import { loadFixture, readXML } from './test-utils.js';
  2. import assert from 'node:assert/strict';
  3. import { before, describe, it } from 'node:test';
  4. describe('routes', () => {
  5. /** @type {import('./test-utils.js').Fixture} */
  6. let fixture;
  7. /** @type {string[]} */
  8. let urls;
  9. before(async () => {
  10. fixture = await loadFixture({
  11. root: './fixtures/static/',
  12. });
  13. await fixture.build();
  14. const data = await readXML(fixture.readFile('/sitemap-0.xml'));
  15. urls = data.urlset.url.map((url) => url.loc[0]);
  16. });
  17. it('does not include endpoints', async () => {
  18. assert.equal(urls.includes('http://example.com/endpoint.json'), false);
  19. });
  20. it('does not include redirects', async () => {
  21. assert.equal(urls.includes('http://example.com/redirect'), false);
  22. });
  23. });