This repository has been archived on 2023-03-26. You can view files and clone it, but cannot push or open issues or pull requests.
tstatic/tests/helpers.ts

15 lines
454 B
TypeScript
Raw Permalink Normal View History

2017-02-19 21:59:54 +00:00
import createServer from '../src/server';
import { Options } from '../src/types';
2017-02-19 18:19:45 +00:00
import fetch from 'node-fetch';
export function runServer(opts: Object, url : string, callback: Function) {
2017-02-19 19:01:53 +00:00
const app = createServer(opts as Options);
const server = app.listen(1234, function () {
return fetch('http://0.0.0.0:1234' + url).then(function (response : any) {
server.close();
callback(response);
});
2017-02-19 18:19:45 +00:00
});
}