astro/packages/astro/test/static-build-page-dist-url.test.js
Tony Sullivan b8c6dabfb7
Enables eslint on the full repo and adds a rule for no only() tests (#3659)
* enabling eslint on the all packages and tests

* enabling for all packages

* TEMP: adding an only() test to verify it fails CI

* using our eslint config and ignore in CI

* removing the temporary .only() test

* update lock file

* lint: fixing new test with a no-shadow warning

* chore: update lock file
2022-06-22 15:59:49 +00:00

35 lines
881 B
JavaScript

import { expect } from 'chai';
import { loadFixture } from './test-utils.js';
describe('Static build: pages routes have distURL', () => {
/** @type {RouteData[]} */
let checkRoutes;
before(async () => {
/** @type {import('./test-utils').Fixture} */
const fixture = await loadFixture({
root: './fixtures/astro pages/',
integrations: [
{
name: '@astrojs/distURL',
hooks: {
'astro:build:done': ({ routes }) => {
checkRoutes = routes.filter((p) => p.type === 'page');
},
},
},
],
});
await fixture.build();
});
it('Pages routes have distURL', async () => {
expect(checkRoutes).to.have.lengthOf.above(
0,
'Pages not found: build end hook not being called'
);
checkRoutes.forEach((p) =>
expect(p)
.to.have.property('distURL')
.that.is.a('URL', `${p.pathname} doesn't include distURL`)
);
});
});