Skip to content

Commit

Permalink
automagically migrate to latest AVA
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Apr 7, 2016
1 parent d360a1d commit b09afd0
Show file tree
Hide file tree
Showing 10 changed files with 20 additions and 20 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"url-parse-lax": "^1.0.0"
},
"devDependencies": {
"ava": "^0.13.0",
"ava": "^0.14.0",
"coveralls": "^2.11.4",
"get-port": "^2.0.0",
"into-stream": "^2.0.0",
Expand Down
10 changes: 5 additions & 5 deletions test/error.js
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,10 @@ test('properties', async t => {
await got(s.url);
t.fail('Exception was not thrown');
} catch (err) {
t.ok(err);
t.ok(err.response);
t.ok(!err.propertyIsEnumerable('response'));
t.ok(!err.hasOwnProperty('code'));
t.truthy(err);
t.truthy(err.response);
t.truthy(!err.propertyIsEnumerable('response'));
t.truthy(!err.hasOwnProperty('code'));
t.is(err.message, 'Response code 404 (Not Found)');
t.is(err.host, `${s.host}:${s.port}`);
t.is(err.method, 'GET');
Expand All @@ -35,7 +35,7 @@ test('dns message', async t => {
await got('.com', {retries: 0});
t.fail('Exception was not thrown');
} catch (err) {
t.ok(err);
t.truthy(err);
t.regex(err.message, /getaddrinfo ENOTFOUND/);
t.is(err.host, '.com');
t.is(err.method, 'GET');
Expand Down
2 changes: 1 addition & 1 deletion test/gzip.js
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ test('handles gzip error', async t => {
});

test('preserve headers property', async t => {
t.ok((await got(s.url)).headers);
t.truthy((await got(s.url)).headers);
});

test('do not break HEAD responses', async t => {
Expand Down
2 changes: 1 addition & 1 deletion test/helpers.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ test('promise mode', async t => {
await got.get('.com', {retries: 0});
t.fail('Exception was not thrown');
} catch (err) {
t.ok(err);
t.truthy(err);
}
});

Expand Down
2 changes: 1 addition & 1 deletion test/http.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ test('error with code', async t => {

test('buffer on encoding === null', async t => {
const data = (await got(s.url, {encoding: null})).body;
t.ok(Buffer.isBuffer(data));
t.truthy(Buffer.isBuffer(data));
});

test('timeout option', async t => {
Expand Down
2 changes: 1 addition & 1 deletion test/https.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ test.before('setup', async () => {
});

test('make request to https server without ca', async t => {
t.ok((await got(s.url, {rejectUnauthorized: false})).body);
t.truthy((await got(s.url, {rejectUnauthorized: false})).body);
});

test('make request to https server with ca', async t => {
Expand Down
6 changes: 3 additions & 3 deletions test/json.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ test.before('setup', async () => {
});

test('parses response', async t => {
t.same((await got(s.url, {json: true})).body, {data: 'dog'});
t.deepEqual((await got(s.url, {json: true})).body, {data: 'dog'});
});

test('not parses responses without a body', async t => {
Expand All @@ -48,7 +48,7 @@ test('wraps parsing errors', async t => {
t.fail('Exception was not thrown');
} catch (err) {
t.regex(err.message, /Unexpected token/);
t.ok(err.message.indexOf(err.hostname) !== -1, err.message);
t.truthy(err.message.indexOf(err.hostname) !== -1, err.message);
t.is(err.path, '/invalid');
}
});
Expand All @@ -58,7 +58,7 @@ test('parses non-200 responses', async t => {
await got(`${s.url}/non200`, {json: true});
t.fail('Exception was not thrown');
} catch (err) {
t.same(err.response.body, {data: 'dog'});
t.deepEqual(err.response.body, {data: 'dog'});
}
});

Expand Down
2 changes: 1 addition & 1 deletion test/redirects.js
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ test('redirect only GET and HEAD requests', async t => {
});

test('redirects from http to https works', async t => {
t.ok((await got(`${http.url}/httpToHttps`, {rejectUnauthorized: false})).body);
t.truthy((await got(`${http.url}/httpToHttps`, {rejectUnauthorized: false})).body);
});

test('redirects works with lowercase method', async t => {
Expand Down
8 changes: 4 additions & 4 deletions test/retry.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ test('can be disabled with option', async t => {
await got(`${s.url}/try-me`, {timeout: 500, retries: 0});
t.fail();
} catch (err) {
t.ok(err);
t.truthy(err);
t.is(trys, 1);
}
});
Expand All @@ -54,18 +54,18 @@ test('falsy value prevents retries', async t => {
try {
await got(`${s.url}/long`, {timeout: 100, retries: () => 0});
} catch (err) {
t.ok(err);
t.truthy(err);
}
});

test('falsy value prevents retries #2', async t => {
try {
await got(`${s.url}/long`, {timeout: 100, retries: (iter, err) => {
t.ok(err);
t.truthy(err);
return false;
}});
} catch (err) {
t.ok(err);
t.truthy(err);
}
});

Expand Down
4 changes: 2 additions & 2 deletions test/stream.js
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ test.cb('throws on write to stream with body specified', t => {
test.cb('have request event', t => {
got.stream(s.url)
.on('request', req => {
t.ok(req);
t.truthy(req);
t.end();
});
});
Expand Down Expand Up @@ -95,7 +95,7 @@ test.cb('have error event', t => {
.on('error', (err, data, res) => {
t.is(err.message, 'Response code 404 (Not Found)');
t.is(null, data);
t.ok(res);
t.truthy(res);
t.end();
});
});
Expand Down

0 comments on commit b09afd0

Please sign in to comment.