mirror of
https://github.com/kevin-DL/sapper.git
synced 2026-01-12 11:15:14 +00:00
48 lines
1.1 KiB
TypeScript
48 lines
1.1 KiB
TypeScript
import * as assert from 'assert';
|
|
import { walk } from '../../utils';
|
|
import * as api from '../../../api';
|
|
|
|
describe('export', function() {
|
|
this.timeout(10000);
|
|
|
|
// hooks
|
|
before('build app', () => api.build({ cwd: __dirname }));
|
|
before('export app', () => api.export({ cwd: __dirname }));
|
|
|
|
// tests
|
|
it('crawls a site', () => {
|
|
const files = walk(`${__dirname}/__sapper__/export`);
|
|
|
|
const client_assets = files.filter(file => file.startsWith('sapper/'));
|
|
const non_client_assets = files.filter(file => !file.startsWith('sapper/')).sort();
|
|
|
|
assert.ok(client_assets.length > 0);
|
|
|
|
const boom = ['boom/index.html'];
|
|
for (let a = 1; a <= 20; a += 1) {
|
|
boom.push(`boom/${a}/index.html`);
|
|
for (let b = 1; b <= 20; b += 1) {
|
|
boom.push(`boom/${a}/${b}/index.html`);
|
|
}
|
|
}
|
|
|
|
assert.deepEqual(non_client_assets.sort(), [
|
|
'blog.json',
|
|
'blog/bar.json',
|
|
'blog/bar/index.html',
|
|
'blog/baz.json',
|
|
'blog/baz/index.html',
|
|
'blog/foo.json',
|
|
'blog/foo/index.html',
|
|
'blog/index.html',
|
|
'global.css',
|
|
'index.html',
|
|
'service-worker-index.html',
|
|
'service-worker.js',
|
|
...boom
|
|
].sort());
|
|
});
|
|
|
|
// TODO test timeout, basepath
|
|
});
|