You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 

33 lines
679 B

import {format} from 'util';
import tempy from 'tempy';
import test from 'ava';
import got from '..';
import {createServer} from './helpers/server';
const socketPath = tempy.file({extension: 'socket'});
let s;
test.before('setup', async () => {
s = await createServer();
s.on('/', (req, res) => {
res.end('ok');
});
await s.listen(socketPath);
});
test('works', async t => {
const url = format('http://unix:%s:%s', socketPath, '/');
t.is((await got(url)).body, 'ok');
});
test('protocol-less works', async t => {
const url = format('unix:%s:%s', socketPath, '/');
t.is((await got(url)).body, 'ok');
});
test.after('cleanup', async () => {
await s.close();
});