本文整理汇总了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();
示例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))
}
});
示例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
}
})
示例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);
}
});