Skip to content

Commit

Permalink
Fix unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
daldridge-cs committed Sep 18, 2018
1 parent 8001bda commit 3050336
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 12 deletions.
2 changes: 1 addition & 1 deletion lib/docker.js
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ class DockerClient {

options = options || {};

return self._validate(options, schemas.auth.options).then((params) => {
return self._validate(options, schemas.auth).then((params) => {
return self.modem.post({
url: '/auth',
body: params,
Expand Down
12 changes: 9 additions & 3 deletions test/images/inspect.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict';

const Code = require('code');
const Lab = require('lab');
const harness = require('../harness');

Expand All @@ -13,9 +14,14 @@ lab.experiment('images - inspect', () => {
.get('/images/hello-world/json')
.reply(200, {});

const req = harness.client.images().inspect('hello-world');

harness.handleSuccess(scope, 200, req, done);
harness.client.images().inspect('hello-world').then(() => {
Code.expect(scope.isDone()).to.equal(true);
}, () => {
Code.fail('should be a 200 response');
}).finally(() => {
harness.clean();
done();
});

});

Expand Down
13 changes: 10 additions & 3 deletions test/images/list.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict';

const Code = require('code');
const Lab = require('lab');
const harness = require('../harness');

Expand All @@ -11,11 +12,17 @@ lab.experiment('images - list', () => {

const scope = harness.mock()
.get('/images/json')
.query({all: false, digest: false})
.reply(200, {});

const req = harness.client.images().list();

harness.handleSuccess(scope, 200, req, done);
harness.client.images().list().then(() => {
Code.expect(scope.isDone()).to.equal(true);
}, () => {
Code.fail('should be a 200 response');
}).finally(() => {
harness.clean();
done();
});

});

Expand Down
14 changes: 9 additions & 5 deletions test/images/search.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
'use strict';

const Code = require('code');
const Lab = require('lab');
const harness = require('../harness');

Expand All @@ -11,15 +12,18 @@ lab.experiment('images - search', () => {

const scope = harness.mock()
.get('/images/search')
.query({ term: 'hello-world' })
.query({term: 'hello-world'})
.reply(200, {});

const req = harness.client.images().search({
term: 'hello-world'
harness.client.images().search({term: 'hello-world'}).then(() => {
Code.expect(scope.isDone()).to.equal(true);
}, () => {
Code.fail('should be a 200 response');
}).finally(() => {
harness.clean();
done();
});

harness.handleSuccess(scope, 200, req, done);

});

});

0 comments on commit 3050336

Please sign in to comment.