Sails.js 带Vowsjs的Sailsjs水线模型的TDD

Sails.js 带Vowsjs的Sailsjs水线模型的TDD,sails.js,vows,waterline,Sails.js,Vows,Waterline,我的问题是尝试对水线模型进行TDD。我提供的测试只是构建套件的样板。然而,它们提出了一些合理的问题。主要问题是我需要在Vows.js测试中使用该模型。在测试范围中定义了模型,但它没有从Waterline包继承的任何属性。例如,下面是“EducationLevel”的一些模型代码: 以下是一些试验测试: vows = require('vows') assert = require('assert') EducationLevel = require('../api/models/Educatio

我的问题是尝试对水线模型进行TDD。我提供的测试只是构建套件的样板。然而,它们提出了一些合理的问题。主要问题是我需要在Vows.js测试中使用该模型。在测试范围中定义了模型,但它没有从Waterline包继承的任何属性。例如,下面是“EducationLevel”的一些模型代码:

以下是一些试验测试:

vows = require('vows')
assert = require('assert')
EducationLevel = require('../api/models/EducationLevel')

vows.describe('tac_models').addBatch({
  'EducationLevel model' : {
    topic: function(){
      educationLevel = EducationLevel.create();
      return true;
    },
    'It exists': function (topic) {
      assert.equal(EducationLevel.create,undefined);
      assert.equal(EducationLevel.migrate,undefined);
    }
  }
}).export(module)
运行测试时,第一个断言通过,但第二个断言没有:

 vows spec/*
 ✗  


    EducationLevel model 
      ✗ It exists 
        » expected undefined, 
    got  'safe' (==) // tac_models.js:13 
  ✗ Broken » 1 broken (1.545s) 
这表明测试只知道EducationLevel定义中显式声明的内容。之所以定义“migrate”属性,是因为我在代码中明确定义了它。它不知道水线方法“create”。我怎样才能以一种使传统TDD实用的方式解决这个问题

 vows spec/*
 ✗  


    EducationLevel model 
      ✗ It exists 
        » expected undefined, 
    got  'safe' (==) // tac_models.js:13 
  ✗ Broken » 1 broken (1.545s)