aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorValentin Popov <info@valentineus.link>2017-10-07 16:48:05 +0300
committerValentin Popov <info@valentineus.link>2017-10-07 16:48:05 +0300
commit72dfa17df48760efb399e1d6e9c946d8870a2b6b (patch)
tree063dfe39c8e5cee0b32ff84597988f443d187a26 /src
parent8adbea869e3b6542c663aab28ab101c5e7df0063 (diff)
downloadsimple-container-72dfa17df48760efb399e1d6e9c946d8870a2b6b.tar.xz
simple-container-72dfa17df48760efb399e1d6e9c946d8870a2b6b.zip
Full-featured testing
Diffstat (limited to 'src')
-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