UNPKG

bit-bin

Version:

<a href="https://opensource.org/licenses/Apache-2.0"><img alt="apache" src="https://img.shields.io/badge/License-Apache%202.0-blue.svg"></a> <a href="https://github.com/teambit/bit/blob/master/CONTRIBUTING.md"><img alt="prs" src="https://img.shields.io/b

107 lines (82 loc) 2.45 kB
"use strict"; var _interopRequireWildcard = require("@babel/runtime/helpers/interopRequireWildcard"); var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); function _chai() { const data = require("chai"); _chai = function () { return data; }; return data; } function _sinon() { const data = _interopRequireDefault(require("sinon")); _sinon = function () { return data; }; return data; } function _listScope() { const data = require("../../../api/consumer/lib/list-scope"); _listScope = function () { return data; }; return data; } function _exceptions() { const data = require("../../../consumer/exceptions"); _exceptions = function () { return data; }; return data; } function consumer() { const data = _interopRequireWildcard(require("../../../consumer")); consumer = function () { return data; }; return data; } function _globalConfig() { const data = require("../../../global-config"); _globalConfig = function () { return data; }; return data; } function _remotes() { const data = _interopRequireDefault(require("../../../remotes/remotes")); _remotes = function () { return data; }; return data; } describe('ListScope', () => { let sandbox; before(() => { sandbox = _sinon().default.createSandbox(); }); after(() => { sandbox.restore(); }); // @todo: currently this functionality is not working. // the migrate feature needs the consumer to be available and throw an error otherwise. describe.skip('list', () => { it('should list components outside a scope if scopeName is given', () => { sandbox.stub(consumer(), 'loadConsumer').returns(Promise.reject(new (_exceptions().ConsumerNotFound)())); sandbox.stub(_globalConfig().GlobalRemotes, 'load').returns(Promise.resolve({ toPlainObject: () => {} })); const listSpy = sandbox.spy(); const resolveStub = sandbox.stub(_remotes().default.prototype, 'resolve').returns(Promise.resolve({ list: listSpy })); const result = (0, _listScope().listScope)({ scopeName: 'non-exists-scope' }); (0, _chai().expect)(result).to.be.a('Promise'); return result.then(() => { (0, _chai().expect)(resolveStub.getCall(0).args[0]).to.equal('non-exists-scope'); (0, _chai().expect)(listSpy.called).to.be.true; }); }).timeout(5000); }); });