2017-03-26 11:02:20 +00:00
|
|
|
import "typings-global";
|
|
|
|
import { expect, tap } from 'tapbundle'
|
2017-04-02 13:30:43 +00:00
|
|
|
import * as observableToPromise from 'observable-to-promise'
|
2017-04-02 10:05:29 +00:00
|
|
|
import { Dockersock } from "../dist/index";
|
|
|
|
|
|
|
|
let testDockersock: Dockersock;
|
|
|
|
|
|
|
|
tap.test("should create a new Dockersock instance", async () => {
|
|
|
|
testDockersock = new Dockersock();
|
|
|
|
return expect(testDockersock).to.be.instanceof(Dockersock);
|
2017-07-16 10:04:35 +00:00
|
|
|
})
|
2017-04-02 10:05:29 +00:00
|
|
|
|
|
|
|
tap.test("should list containers", async () => {
|
2017-07-16 10:04:35 +00:00
|
|
|
let data = await testDockersock.listContainers()
|
|
|
|
console.log(data)
|
|
|
|
})
|
2017-04-02 10:05:29 +00:00
|
|
|
|
|
|
|
tap.test("should list detailed containers", async () => {
|
2017-07-16 10:04:35 +00:00
|
|
|
let data = await testDockersock.listContainersDetailed()
|
|
|
|
console.log(data)
|
|
|
|
})
|
2017-04-02 10:05:29 +00:00
|
|
|
|
|
|
|
tap.test("should pull an image from imagetag", async () => {
|
2017-04-02 13:30:43 +00:00
|
|
|
await testDockersock.pullImage("hosttoday/ht-docker-node:npmci")
|
2017-07-16 10:04:35 +00:00
|
|
|
})
|
2017-04-02 10:05:29 +00:00
|
|
|
|
2017-07-16 10:04:35 +00:00
|
|
|
tap.test("should return a change Objservable", async () => {
|
2017-04-02 13:30:43 +00:00
|
|
|
let myObservable = testDockersock.getChangeObservable();
|
2017-04-02 10:05:29 +00:00
|
|
|
testDockersock.endRequests();
|
2017-04-02 13:30:43 +00:00
|
|
|
let testPromise = observableToPromise(myObservable)
|
|
|
|
return await expect(testPromise).to.eventually.be.fulfilled
|
2017-07-16 10:04:35 +00:00
|
|
|
})
|
|
|
|
|
|
|
|
tap.start()
|