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
672 B

import {format} from 'util';
import tempfile from 'tempfile';
import test from 'ava';
import got from '../';
import {createServer} from './helpers/server';
const socketPath = tempfile('.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();
});