UNPKG

navy

Version:

Quick and powerful development environments using Docker and Docker Compose

76 lines (74 loc) 1.89 kB
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); var _chai = require("chai"); var _setImage = _interopRequireDefault(require("../set-image")); /* eslint-env mocha */ describe('set-image middleware', function () { it('should leave the image unchanged when no state image is set', function () { const config = { services: { api: { image: 'api:1' } } }; const state = { services: { api: {} } }; const result = (0, _setImage.default)(config, state); (0, _chai.expect)(result.services.api.image).to.equal('api:1'); }); it('should leave the image unchanged when there is no service state at all', function () { const config = { services: { api: { image: 'api:1' } } }; const state = { services: {} }; const result = (0, _setImage.default)(config, state); (0, _chai.expect)(result.services.api.image).to.equal('api:1'); }); it('should override the image when state has one', function () { const config = { services: { api: { image: 'api:1' } } }; const state = { services: { api: { image: 'api:override' } } }; const result = (0, _setImage.default)(config, state); (0, _chai.expect)(result.services.api.image).to.equal('api:override'); }); it('should preserve other service config keys', function () { const config = { services: { api: { image: 'api:1', ports: ['80:80'] } } }; const state = { services: { api: { image: 'api:override' } } }; const result = (0, _setImage.default)(config, state); (0, _chai.expect)(result.services.api.ports).to.eql(['80:80']); }); });