在单元测试中使用Cloud SDK

时间:2018-11-24 21:25:11

标签: unit-testing sails.js

我在这里遵循了指南-https://sailsjs.com/documentation/concepts/testing

所以我的lifecycle.test.js看起来像这样:

var sails = require('sails');

// Before running any tests...
before(function(done) {

  // Increase the Mocha timeout so that Sails has enough time to lift, even if you have a bunch of assets.
  this.timeout(5000);

  sails.lift({
    // Your sails app's configuration files will be loaded automatically,
    // but you can also specify any other special overrides here for testing purposes.

    // For example, we might want to skip the Grunt hook,
    // and disable all logs except errors and warnings:
    hooks: { grunt: false },
    log: { level: 'warn' },

  }, function(err) {
    if (err) { return done(err); }

    // here you can load fixtures, etc.
    // (for example, you might want to create some records in the database)

    return done();
  });
});

// After all tests have finished...
after(function(done) {

  // here you can clear fixtures, etc.
  // (e.g. you might want to destroy the records you created above)

  sails.lower(done);

});

但是在测试中,我无法使用Cloud。我认为这对我来说是可用的,因为我在这里的测试套件中看到它们使用Cloud-https://github.com/mikermcneil/ration/tree/master/test/suites

我是否需要修改lifecycle.test.js才能使用Cloud

0 个答案:

没有答案