How to use the mockery.deregisterMock function in mockery

To help you get started, we’ve selected a few mockery examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github felixrieseberg / windows-build-tools / test / src / install.js View on Github external
it('should attempt to download the build tools', (done) => {
      const nuggetMock = function (url, options, cb) {
        url.should.equal(constants.buildToolsUrl)
        options.should.be.ok
        options.target.should.be.ok
        options.dir.should.be.ok

        cb()
      }

      mockery.registerMock('nugget', nuggetMock)
      require('../../lib/download')().should.be.fulfilled.and.notify(done)
      mockery.deregisterMock('nugget')
    })
  })
github richardwillars / thinglator / test / unit / models / event.js View on Github external
afterEach(function(done) {
		mockery.deregisterMock('mongoose');
		mockery.deregisterMock('../utils/event');
		done();
	});
github richardwillars / thinglator / test / models / light.js View on Github external
afterEach((done) => {
        mockery.deregisterMock('mongoose');
        mockery.deregisterMock('eventemitter2');
        mockery.deregisterMock('./event');
        mockery.deregisterMock('../utils/event');
        done();
    });
github richardwillars / thinglator / test / models / socket.js View on Github external
afterEach((done) => {
        mockery.deregisterMock('mongoose');
        mockery.deregisterMock('eventemitter2');
        mockery.deregisterMock('../utils/event');
        mockery.deregisterMock('./event');
        done();
    });
github Hacklone / private-bower / lib / spec / main.spec.js View on Github external
it('should call load configuration with parametered config path', function() {
            var fakeConfigPath = 'fakeConfig.conf';
            mockery.registerMock('optimist', { argv: { config: fakeConfigPath } });
            
            configurationManagerMock.loadConfiguration.reset();
            mockery.resetCache();
            
            createMain();
            
            main.start();
            
            expect(configurationManagerMock.loadConfiguration).to.have.been.calledWith(fakeConfigPath);
            
            mockery.deregisterMock('optimist');
        });

mockery

Simplifying the use of mocks with Node.js

Unrecognized
Latest version published 7 years ago

Package Health Score

35 / 100
Full package analysis