当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript buster.testCase函数代码示例

本文整理汇总了TypeScript中buster.testCase函数的典型用法代码示例。如果您正苦于以下问题:TypeScript testCase函数的具体用法?TypeScript testCase怎么用?TypeScript testCase使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了testCase函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。

示例1: require

var when = require("when");

buster.testCase("Query test", {
  setUp: function () {
    Ground_Test.setup(this);
    return this.fixture.prepare_database()
  },
  select: function () {
    var query = this.ground.create_query('character_item');
    Ground.Update.log_queries = true;
    return this.fixture.populate()
      .then(()=> this.ground.create_query('warrior').run())
      .then((objects)=> {
        console.log(arguments)
        assert.equals(1, objects.length);
        assert.equals('Bob', objects[0].name);
      })

      .then(()=> query.run())
      .then((objects)=> {
        console.log(objects)
        assert.equals(1, objects[0].owner.id);
      })

      .then(()=> query.run_as_service())
      .then((result)=> {
        assert.equals(1, result.objects[0].owner.id);
      })
  }
});

require('source-map-support').install();
开发者ID:durandal79,项目名称:ground_js,代码行数:32,代码来源:query-test.ts

示例2: function

buster.testCase("Database test", {

  setUp: function () {
    Ground_Test.setup(this);
//    var stack = new Error().stack
//    console.log( new Error().stack )
  },
//  "drop all tables": function () {
//    return this.db.drop_all_tables()
//      .then(()=> this.db.get_tables())
//      .then((tables) => assert.equals(0, tables.length))
//  },
//  "create table": function () {
//    this.fixture.load_schema();
//    return this.db.drop_all_tables()
//      .then(()=>this.db.create_table(this.ground.trellises['warrior']))
//      .then(() => this.db.get_tables())
//      .then((tables) => assert.equals(1, tables.length))
//  },
  "map table name": function () {
    return this.fixture.prepare_database()
      .then(()=> this.db.query('SELECT * FROM base_objects'))
      .then((rows)=>assert(true))
  },
  "populate": function () {
    return this.fixture.prepare_database()
      .then(()=>this.fixture.populate())
      .then(()=> this.db.query('SELECT * FROM warriors'))
      .then((rows)=>assert.greater(rows.length, 0))
  }

});
开发者ID:durandal79,项目名称:ground_js,代码行数:32,代码来源:db-test.ts

示例3: require

/// <reference path="../../node_modules/vineyard-plantlab/plantlab.d.ts"/>
var buster = require("buster");
var assert = buster.referee.assert;
var when = require('when')

buster.testCase("Simple test", {
  setUp: function () {
    this.timeout = 10000;
  },
  "always true": function () {
    assert(true)
  },
  "promise": function () {
    var def = when.defer()
    setTimeout(function() {
      assert(true)
      def.resolve()
    }, 10)
    return def.promise
  }
})
开发者ID:durandal79,项目名称:vineyard-test-suite,代码行数:21,代码来源:simple-test.ts

示例4: require

/**
 * User: Chris Johnson
 * Date: 9/23/13
 */
/// <reference path="../Ground_Test.ts"/>
/// <reference path="../../defs/buster.d.ts"/>
import Ground_Test = require('../Ground_Test');
var buster = require("buster");

buster.testCase("Database test", {

  setUp: function () {
    var fixture = new Ground_Test.Fixture('test');
    this.ground = fixture.ground;
    this.db = fixture.ground.db;
//    return this.db.drop_all_tables();
  },
  "load trellises": function()  {
    this.ground.load_schema_from_file('test-trellises.json');
    assert.greater(Object.keys(this.ground.trellises).length, 0);
    assert.greater(Object.keys(this.ground.trellises['warrior'].properties).length, 2);
    assert.greater(Object.keys(this.ground.property_types).length, 10);

  }

});
开发者ID:durandal79,项目名称:ground_js,代码行数:26,代码来源:core-test.ts


注:本文中的buster.testCase函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。