How to use mockery-next - 10 common examples

To help you get started, we’ve selected a few mockery-next 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 googleapis / google-cloud-node / test / common / util.js View on Github external
before(function() {
    mockery.registerMock('google-auto-auth', fakeGoogleAutoAuth);
    mockery.registerMock('request', fakeRequest);
    mockery.registerMock('retry-request', fakeRetryRequest);
    mockery.registerMock('stream-events', fakeStreamEvents);
    mockery.enable({
      useCleanCache: true,
      warnOnUnregistered: false
    });
    util = require('../../lib/common/util');
    var utilCached = extend(true, {}, util);

    // Override all util methods, allowing them to be mocked. Overrides are
    // removed before each test.
    Object.keys(util).forEach(function(utilMethod) {
      if (typeof util[utilMethod] !== 'function') {
        return;
      }
github googleapis / google-cloud-node / test / resource / project.js View on Github external
before(function() {
    mockery.registerMock(
      '../../lib/common/service-object.js',
      FakeServiceObject
    );

    mockery.enable({
      useCleanCache: true,
      warnOnUnregistered: false
    });

    Project = require('../../lib/resource/project.js');
  });
github googleapis / google-cloud-node / test / common / grpc-service-object.js View on Github external
before(function() {
    mockery.registerMock(
      '../../lib/common/service-object.js',
      FakeServiceObject
    );

    mockery.enable({
      useCleanCache: true,
      warnOnUnregistered: false
    });

    GrpcServiceObject = require('../../lib/common/grpc-service-object.js');
  });
github googleapis / google-cloud-node / test / compute / firewall.js View on Github external
before(function() {
    mockery.registerMock(
      '../../lib/common/service-object.js',
      FakeServiceObject
    );
    mockery.enable({
      useCleanCache: true,
      warnOnUnregistered: false
    });

    Firewall = require('../../lib/compute/firewall.js');
  });
github googleapis / google-cloud-node / test / storage / channel.js View on Github external
before(function() {
    mockery.registerMock(
      '../../lib/common/service-object.js',
      FakeServiceObject
    );

    mockery.enable({
      useCleanCache: true,
      warnOnUnregistered: false
    });

    Channel = require('../../lib/storage/channel.js');
  });
github googleapis / google-cloud-node / test / search / index-class.js View on Github external
before(function() {
    mockery.registerMock(
      '../../lib/common/service-object.js',
      FakeServiceObject
    );
    mockery.registerMock('../../lib/common/stream-router.js', fakeStreamRouter);
    mockery.registerMock('../../lib/search/document.js', FakeDocument);

    mockery.enable({
      useCleanCache: true,
      warnOnUnregistered: false
    });

    Index = require('../../lib/search/index-class.js');
  });
github googleapis / google-cloud-node / test / vision / index.js View on Github external
before(function() {
    mockery.registerMock('request', fakeRequest);
    mockery.registerMock('../../lib/storage/file.js', FakeFile);
    mockery.registerMock('../../lib/common/service.js', FakeService);
    mockery.registerMock('../../lib/common/util.js', fakeUtil);

    mockery.enable({
      useCleanCache: true,
      warnOnUnregistered: false
    });

    Vision = require('../../lib/vision/index.js');
  });
github googleapis / google-cloud-node / test / storage / bucket.js View on Github external
before(function() {
    mockery.registerMock('async', fakeAsync);
    mockery.registerMock('request', fakeRequest);
    mockery.registerMock(
      '../../lib/common/service-object.js',
      FakeServiceObject
    );
    mockery.registerMock('../../lib/common/stream-router.js', fakeStreamRouter);
    mockery.registerMock('../../lib/storage/acl.js', FakeAcl);
    mockery.registerMock('../../lib/storage/file.js', FakeFile);

    mockery.enable({
      useCleanCache: true,
      warnOnUnregistered: false
    });

    Bucket = require('../../lib/storage/bucket.js');
  });
github googleapis / google-cloud-node / test / storage / file.js View on Github external
before(function() {
    mockery.registerMock('gcs-resumable-upload', fakeResumableUpload);
    mockery.registerMock('request', fakeRequest);
    mockery.registerMock(
      '../../lib/common/service-object.js',
      FakeServiceObject
    );
    mockery.registerMock('../../lib/common/util.js', fakeUtil);

    mockery.enable({
      useCleanCache: true,
      warnOnUnregistered: false
    });

    File = require('../../lib/storage/file.js');
    duplexify = require('duplexify');
  });
github googleapis / google-cloud-node / test / bigtable / index.js View on Github external
before(function() {
    mockery.registerMock('../../lib/common/grpc-service.js', FakeGrpcService);
    mockery.registerMock('../../lib/common/util.js', fakeUtil);
    mockery.registerMock('../../lib/bigtable/table.js', FakeTable);

    mockery.enable({
      useCleanCache: true,
      warnOnUnregistered: false
    });

    Bigtable = require('../../lib/bigtable/index.js');
  });

mockery-next

Simplifying the use of mocks with Node.js

Unrecognized
Latest version published 9 years ago

Package Health Score

42 / 100
Full package analysis

Popular mockery-next functions