Browse Source

⬆️ ava@0.12.0

node-7
Sindre Sorhus 9 years ago
parent
commit
14a05b3ed6
  1. 2
      package.json
  2. 4
      test/arguments.js
  3. 4
      test/error.js
  4. 4
      test/json.js
  5. 2
      test/stream.js

2
package.json

@ -59,7 +59,7 @@
"url-parse-lax": "^1.0.0"
},
"devDependencies": {
"ava": "^0.11.0",
"ava": "^0.12.0",
"coveralls": "^2.11.4",
"get-port": "^2.0.0",
"into-stream": "^2.0.0",

4
test/arguments.js

@ -28,7 +28,7 @@ test('url is required', async t => {
await got();
t.fail('Exception was not thrown');
} catch (err) {
t.regexTest(/Parameter `url` must be a string or object, not undefined/, err.message);
t.regex(err.message, /Parameter `url` must be a string or object, not undefined/);
}
});
@ -49,7 +49,7 @@ test('should throw with auth in url', async t => {
await got('https://test:45d3ps453@account.myservice.com/api/token');
t.fail('Exception was not thrown');
} catch (err) {
t.regexTest(/Basic authentication must be done with auth option/, err.message);
t.regex(err.message, /Basic authentication must be done with auth option/);
}
});

4
test/error.js

@ -36,7 +36,7 @@ test('dns message', async t => {
t.fail('Exception was not thrown');
} catch (err) {
t.ok(err);
t.regexTest(/getaddrinfo ENOTFOUND/, err.message);
t.regex(err.message, /getaddrinfo ENOTFOUND/);
t.is(err.host, '.com');
t.is(err.method, 'GET');
}
@ -47,7 +47,7 @@ test('options.body error message', async t => {
await got(s.url, {body: () => {}});
t.fail('Exception was not thrown');
} catch (err) {
t.regexTest(/options.body must be a ReadableStream, string, Buffer or plain Object/, err.message);
t.regex(err.message, /options.body must be a ReadableStream, string, Buffer or plain Object/);
}
});

4
test/json.js

@ -47,7 +47,7 @@ test('wraps parsing errors', async t => {
await got(`${s.url}/invalid`, {json: true});
t.fail('Exception was not thrown');
} catch (err) {
t.regexTest(/Unexpected token/, err.message);
t.regex(err.message, /Unexpected token/);
t.ok(err.message.indexOf(err.hostname) !== -1, err.message);
t.is(err.path, '/invalid');
}
@ -67,7 +67,7 @@ test('catches errors on invalid non-200 responses', async t => {
await got(`${s.url}/non200-invalid`, {json: true});
t.fail('Exception was not thrown');
} catch (err) {
t.regexTest(/Unexpected token/, err.message);
t.regex(err.message, /Unexpected token/);
t.is(err.response.body, 'Internal error');
t.is(err.path, '/non200-invalid');
}

2
test/stream.js

@ -106,7 +106,7 @@ test.cb('have error event', t => {
t.fail('response event should not be emitted');
})
.on('error', err => {
t.regexTest(/getaddrinfo ENOTFOUND/, err.message);
t.regex(err.message, /getaddrinfo ENOTFOUND/);
t.end();
});
});

Loading…
Cancel
Save