mirror of
https://github.com/withastro/astro.git
synced 2024-12-23 21:53:55 -05:00
ec745d689a
* Remove experimental flag for redirects config * Remove experimental from tests * Remove experimental CLI flag * Add changeset * Removing redirect test that is no longer relevant * Remove experimental label" * Update .changeset/dry-beers-grow.md Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * Update .changeset/dry-beers-grow.md Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca> * Remove old function --------- Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
35 lines
933 B
JavaScript
35 lines
933 B
JavaScript
import { loadFixture } from './test-utils.js';
|
|
import { expect } from 'chai';
|
|
import cloudflare from '../dist/index.js';
|
|
|
|
/** @type {import('./test-utils').Fixture} */
|
|
describe('mode: "directory"', () => {
|
|
let fixture;
|
|
|
|
before(async () => {
|
|
fixture = await loadFixture({
|
|
root: './fixtures/basics/',
|
|
output: 'server',
|
|
adapter: cloudflare({ mode: 'directory' }),
|
|
redirects: {
|
|
'/old': '/',
|
|
},
|
|
});
|
|
await fixture.build();
|
|
});
|
|
|
|
it('generates functions folder inside the project root', async () => {
|
|
expect(await fixture.pathExists('../functions')).to.be.true;
|
|
expect(await fixture.pathExists('../functions/[[path]].js')).to.be.true;
|
|
});
|
|
|
|
it('generates a redirects file', async () => {
|
|
try {
|
|
let _redirects = await fixture.readFile('/_redirects');
|
|
let parts = _redirects.split(/\s+/);
|
|
expect(parts).to.deep.equal(['/old', '/', '301']);
|
|
} catch {
|
|
expect(false).to.equal(true);
|
|
}
|
|
});
|
|
});
|