Improve internal API

This commit is contained in:
Rich Harris
2018-10-08 19:21:15 -04:00
committed by GitHub
parent 5e59855a15
commit 52f40f9e63
46 changed files with 696 additions and 1091 deletions

36
test/apps/store/test.ts Normal file
View File

@@ -0,0 +1,36 @@
import * as assert from 'assert';
import * as puppeteer from 'puppeteer';
import { build } from '../../../api';
import { AppRunner } from '../AppRunner';
describe('store', function() {
this.timeout(10000);
let runner: AppRunner;
let page: puppeteer.Page;
let base: string;
// helpers
let start: () => Promise<void>;
// hooks
before(async () => {
await build({ cwd: __dirname });
runner = new AppRunner(__dirname, '__sapper__/build/server/server.js');
({ base, page, start } = await runner.start());
});
after(() => runner.end());
const title = () => page.$eval('h1', node => node.textContent);
it('renders store props', async () => {
await page.goto(`${base}/store`);
assert.equal(await title(), 'hello world');
await start();
assert.equal(await title(), 'hello world');
});
});