aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--src/tests/index.js54
1 files changed, 43 insertions, 11 deletions
diff --git a/src/tests/index.js b/src/tests/index.js
index 176d192..a76813a 100644
--- a/src/tests/index.js
+++ b/src/tests/index.js
@@ -3,27 +3,59 @@ import { assert } from 'chai';
import Containers from '../lib/index';
describe('simple-container:', () => {
+ var image = 'alpine:latest';
+ var containers = null;
var container = null;
- before((done) => {
- var containers = new Containers();
- var image = 'hello-world:latest';
+ before(() => {
+ containers = new Containers();
+ });
- containers.create(image).then(item => {
+ after((done) => {
+ /* Removing the container after testing */
+ container.remove().then(() => {
+ done();
+ });
+ });
+
+ it('create(image)', (done) => {
+ containers.create(image).then((item) => {
+ assert.isObject(item);
container = item;
done();
});
});
- after((done) => {
- container.stop(() => {
- container.remove(() => {
- done();
- });
+ it('info(id)', (done) => {
+ containers.info(container.id).then((item) => {
+ assert.equal(item.Id, container.id);
+ assert.equal(item.Image, image);
+ assert.isObject(item);
+ done();
+ });
+ });
+
+ it('info()', (done) => {
+ containers.info().then((list) => {
+ var item = list[container.id];
+ assert.equal(item.Id, container.id);
+ assert.equal(item.Image, image);
+ assert.isObject(item);
+ done();
});
});
- it('simple', () => {
- assert.isString(container.id);
+ it('get(id)', (done) => {
+ containers.get(container.id).then((item) => {
+ assert.deepEqual(container, item);
+ done();
+ });
+ });
+
+ it('get()', (done) => {
+ containers.get().then((list) => {
+ assert.deepEqual(container, list[container.id]);
+ done();
+ });
});
}); \ No newline at end of file