Skip to content

Commit

Permalink
Add buildImage() tests that use no-callback, Promise based path
Browse files Browse the repository at this point in the history
  • Loading branch information
kb2ma committed Sep 19, 2022
1 parent f0a5338 commit db00bd0
Showing 1 changed file with 38 additions and 1 deletion.
39 changes: 38 additions & 1 deletion test/docker.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,23 @@ describe("#docker", function() {
docker.buildImage('./test/test.tar', {}, handler);
});

it("should build image from file using Promise", function(done) {
this.timeout(60000);

docker.buildImage('./test/test.tar', {}).then((stream) => {
expect(stream).to.be.ok;

stream.pipe(process.stdout, {
end: true
});

stream.on('end', function() {
done();
});
})
.catch(error => done(error))
});

it("should build image from readable stream", function(done) {
this.timeout(60000);

Expand Down Expand Up @@ -175,7 +192,27 @@ describe("#docker", function() {
src: ['Dockerfile', '.dockerignore', 'test.tar']
}, {}, handler);
});


it("should build image from multiple files while respecting the dockerignore file via Promise", function(done) {
this.timeout(60000);

docker.buildImage({
context: __dirname,
src: ['Dockerfile', '.dockerignore', 'test.tar']
}, {}).then((stream) => {
expect(stream).to.be.ok;

stream.pipe(process.stdout, {
end: true
});

stream.on('end', function() {
done();
});
})
.catch(error => done(error))
});

it("should not mutate src array", function(done) {
this.timeout(60000);

Expand Down

0 comments on commit db00bd0

Please sign in to comment.