Skip to content

Commit 013a2b5

Browse files
committed
missing tests on options
1 parent 0e765db commit 013a2b5

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

test/arguments.js

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,17 @@ test('url is required', async t => {
3333
}
3434
});
3535

36+
test('options are optional', async t => {
37+
t.is((await got(`${s.url}/test`)).body, '/test');
38+
});
39+
40+
test('options are optional', t => {
41+
got(`${s.url}/test`, function (err, data) {
42+
t.is(data, '/test');
43+
t.end();
44+
});
45+
});
46+
3647
test('accepts url.parse object as first argument', async t => {
3748
t.is((await got({hostname: s.host, port: s.port, path: '/test'})).body, '/test');
3849
});
@@ -50,6 +61,10 @@ test('should throw with auth in url', async t => {
5061
}
5162
});
5263

64+
test('accepts url.parse object as first argument', async t => {
65+
t.is((await got({hostname: s.host, port: s.port, path: '/test'})).body, '/test');
66+
});
67+
5368
test.after('cleanup', async t => {
5469
await s.close();
5570
});

test/stream.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
import test from 'ava';
22
import got from '../';
3+
import intoStream from 'into-stream';
34
import {createServer} from './_server';
45

56
let s;
@@ -123,6 +124,15 @@ test('have error event', t => {
123124
});
124125
});
125126

127+
test('accepts option.body as Stream', t => {
128+
got.stream(`${s.url}/post`, {body: intoStream(['wow'])})
129+
.on('data', chunk => {
130+
t.is(chunk.toString(), 'wow');
131+
t.end();
132+
});
133+
134+
});
135+
126136
test.after('cleanup', async t => {
127137
await s.close();
128138
});

0 commit comments

Comments
 (0)