Skip to content

Commit

Permalink
Test(main): Minor fixes
Browse files Browse the repository at this point in the history
* Use dotest test() callback
* Changed API urls to HTTPS
  • Loading branch information
fvdm committed Sep 27, 2017
1 parent 962029a commit 17cf5a8
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions test.js
Expand Up @@ -34,10 +34,10 @@ app.config ({
});


dotest.add ('Error: request failed', function () {
dotest.add ('Error: request failed', function (test) {
app.config ({ timeout: 1 });
app.create ('invalid', function (err) {
dotest.test ()
test ()
.isError ('fail', 'err', err)
.isExactly ('fail', 'err.message', err && err.message, 'request failed')
.isError ('fail', 'err.error', err && err.error)
Expand All @@ -46,38 +46,38 @@ dotest.add ('Error: request failed', function () {
});


dotest.add ('.create', function () {
dotest.add ('.create', function (test) {
app.config ({ timeout: timeout });
app.create (false, function (err, data) {
cache.bin = data || null;

if (data) {
http.post ('http://requestb.in/' + data.name, { parameters: cache.post }, function () {});
dotest.log ('info', 'http://requestb.in/' + data.name + '?inspect');
http.post ('https://requestb.in/' + data.name, { parameters: cache.post }, function () {});
dotest.log ('info', 'https://requestb.in/' + data.name + '?inspect');
}

dotest.test (err)
test (err)
.isObject ('fail', 'data', data)
.isString ('warn', 'data.name', data && data.name)
.done ();
});
});


dotest.add ('.get', function () {
dotest.add ('.get', function (test) {
app.get (cache.bin.name, function (err, data) {
dotest.test (err)
test (err)
.isObject ('fail', 'data', data)
.isExactly ('warn', 'data.name', data && data.name, cache.bin.name)
.done ();
});
});


dotest.add ('.requests', function () {
dotest.add ('.requests', function (test) {
app.requests (cache.bin.name, function (err, data) {
cache.request = data && data [0] || null;
dotest.test (err)
test (err)
.isArray ('fail', 'data', data)
.isNotEmpty ('warn', 'data', data)
.isObject ('warn', 'data[0]', data && data [0])
Expand All @@ -86,9 +86,9 @@ dotest.add ('.requests', function () {
});


dotest.add ('.request', function () {
dotest.add ('.request', function (test) {
app.request (cache.bin.name, cache.request.id, function (err, data) {
dotest.test (err)
test (err)
.isObject ('fail', 'data', data)
.isExactly ('warn', 'data.id', data && data.id, cache.request.id)
.done ();
Expand Down

0 comments on commit 17cf5a8

Please sign in to comment.