mirror of
https://github.com/withastro/astro.git
synced 2025-01-06 22:10:10 -05:00
436bd09341
* Fix root pagination `url.prev` for first page * fix lockfile? * add changeset
33 lines
751 B
JavaScript
33 lines
751 B
JavaScript
import { expect } from 'chai';
|
|
import * as cheerio from 'cheerio';
|
|
import { loadFixture } from './test-utils.js';
|
|
|
|
describe('Pagination root', () => {
|
|
let fixture;
|
|
|
|
before(async () => {
|
|
fixture = await loadFixture({
|
|
root: './fixtures/astro-pagination-root-spread/',
|
|
site: 'https://mysite.dev/',
|
|
base: '/blog',
|
|
});
|
|
await fixture.build();
|
|
});
|
|
|
|
it('correct prev url in root spread', async () => {
|
|
const prevMap = {
|
|
'/4/': '/3',
|
|
'/3/': '/2',
|
|
'/2/': '/',
|
|
'/': undefined,
|
|
};
|
|
|
|
await Promise.all(
|
|
Object.entries(prevMap).map(async ([curr, prev]) => {
|
|
const html = await fixture.readFile(curr + 'index.html');
|
|
const $ = cheerio.load(html);
|
|
expect($('#prev').attr('href')).to.equal(prev);
|
|
})
|
|
);
|
|
});
|
|
});
|