本文整理汇总了TypeScript中vows.describe函数的典型用法代码示例。如果您正苦于以下问题:TypeScript describe函数的具体用法?TypeScript describe怎么用?TypeScript describe使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了describe函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: require
const assert = require('assert');
var vows = require('vows');
var _name:string = "test-"+new Date().getTime();
var testConfig = {
test: new Date(),
result: 'ok'
};
var configurationsAPI = require('../../pmodules/configurations/configurationsAPI');
var tests = vows.describe('configurationsAPI');
tests.addBatch({
'configurationsAPI-save': {
topic: {},
'save a new configuration': {
topic: function(topic) {
configurationsAPI.saveConfigruation(_name, testConfig, (err) => {
topic.err = err;
this.callback(null, topic);
});
return;
},
'has been saved': function(topic) {
assert.equal(topic.err, null);
}
}
}
});
tests.addBatch({
示例2: require
/// <reference path='../../../../interfaces/node/node.d.ts'/>
/// <reference path='../../../../interfaces/locomotive/locomotive.d.ts'/>
/// <reference path='../../../../interfaces/should/should.d.ts'/>
/// <reference path='../../../../interfaces/async/async.d.ts'/>
import assert = require("assert");
import http = require("http");
import should = require("should");
import async = require("async");
import testApi = require("../test_api");
var vows = require('vows');
vows.describe("LabelsController").addBatch({
"Server": {
topic: testApi.startServerTopic(),
"Index without user and repository": {
topic: testApi.httpGetTopic("/labels"),
"returns error": testApi.verifyNoUserProvidedError()
},
"Index without user": {
topic: testApi.httpGetTopic("/labels?repository=repo"),
"returns error": testApi.verifyNoUserProvidedError()
},
"Index without repository": {
topic: testApi.httpGetTopic("/labels?user=test"),
"returns error": testApi.verifyNoRepositoryProvidedError()
示例3: require
/// <reference path='../../../../interfaces/node/node.d.ts'/>
/// <reference path='../../../../interfaces/locomotive/locomotive.d.ts'/>
/// <reference path='../../../../interfaces/should/should.d.ts'/>
/// <reference path='../../../../interfaces/async/async.d.ts'/>
import assert = require("assert");
import http = require("http");
import should = require("should");
import async = require("async");
import testApi = require("../test_api");
var vows = require('vows');
vows.describe("IssuesController").addBatch({
"Server": {
topic: testApi.startServerTopic(),
"Index": {
"without user, repository and milestone": {
topic: testApi.httpGetTopic("/issues"),
"returns error": testApi.verifyNoUserProvidedError()
},
"without user and milestone": {
topic: testApi.httpGetTopic("/issues?repository=repo"),
"returns error": testApi.verifyNoUserProvidedError()
},
"without repository and milestone": {
topic: testApi.httpGetTopic("/issues?user=test"),
"returns error": testApi.verifyNoRepositoryProvidedError()
},
"without repository": {
示例4: require
/// <reference path='../../../../interfaces/node/node.d.ts'/>
/// <reference path='../../../../interfaces/locomotive/locomotive.d.ts'/>
/// <reference path='../../../../interfaces/should/should.d.ts'/>
/// <reference path='../../../../interfaces/async/async.d.ts'/>
import assert = require("assert");
import http = require("http");
import should = require("should");
import async = require("async");
import testApi = require("../test_api");
var vows = require('vows');
vows.describe("ImpedimentsController").addBatch({
"Server": {
topic: testApi.startServerTopic(),
"Index without user and repository": {
topic: testApi.httpGetTopic("/impediments/"),
"returns error": testApi.verifyNoUserProvidedError()
},
"Index without user": {
topic: testApi.httpGetTopic("/impediments/?repository=repo"),
"returns error": testApi.verifyNoUserProvidedError()
},
"Index without repository": {
topic: testApi.httpGetTopic("/impediments/?user=test"),
"returns error": testApi.verifyNoRepositoryProvidedError()
},
// ToDo
示例5: require
import assert = require("assert");
import http = require("http");
import should = require("should");
import async = require("async");
import testApi = require("../test_api");
var vows = require('vows');
function testCurrentUserMarker(result: any[]) {
result[0].should.eql({ id: null, login: null, avatar_url: null });
}
vows.describe("CollaboratorsController").addBatch({
"Server": {
topic: testApi.startServerTopic(),
"Index without user and repository": {
topic: testApi.httpGetTopic("/collaborators"),
"returns error": testApi.verifyNoUserProvidedError()
},
"Index without user": {
topic: testApi.httpGetTopic("/collaborators?repository=repo"),
"returns error": testApi.verifyNoUserProvidedError()
},
"Index without repository": {
topic: testApi.httpGetTopic("/collaborators?user=test"),
示例6: require
/// <reference path='../../../../interfaces/node/node.d.ts'/>
/// <reference path='../../../../interfaces/locomotive/locomotive.d.ts'/>
/// <reference path='../../../../interfaces/should/should.d.ts'/>
/// <reference path='../../../../interfaces/async/async.d.ts'/>
import assert = require("assert");
import http = require("http");
import should = require("should");
import async = require("async");
import testApi = require("../test_api");
var vows = require('vows');
vows.describe("UserController").addBatch({
"Server": {
topic: testApi.startServerTopic(),
"User get data": {
topic: testApi.httpGetTopic("/user"),
"is returned correctly": function (err: any, response: http.ClientResponse, textBody: string) {
var result = testApi.verifyJsonResponse(err, response, textBody);
result.name.should.be.exactly("Tester Unit");
result.login.should.be.exactly("utester");
result.avatar_url.should.be.exactly("http://void.com/image.gif");
}
}
}
}).export(module);
示例7: require
/// <reference path='../../../../interfaces/node/node.d.ts'/>
/// <reference path='../../../../interfaces/locomotive/locomotive.d.ts'/>
/// <reference path='../../../../interfaces/should/should.d.ts'/>
/// <reference path='../../../../interfaces/async/async.d.ts'/>
import assert = require("assert");
import http = require("http");
import should = require("should");
import async = require("async");
import testApi = require("../test_api");
var vows = require('vows');
vows.describe("AuthenticationController").addBatch({
"Server": {
topic: testApi.startServerTopic(),
"starts": (err: any) => {
should.not.exist(err);
},
"Verify GET authentication": {
topic: function() {
var self = this;
var getEndpoints = ["/", "/developer_board/test/test/1", "/qa_board/test/test/1" ,"/user", "/labels", "/milestones", "/collaborators", "/issues"];
async.forEachSeries(getEndpoints, (endpoint, callback) => {
testApi.httpGet(endpoint, (err: any, response: http.ClientResponse) => {
should.not.exist(err);
should.exist(response);
response.should.have.status(401);
示例8: require
var assert = require('assert'),
vows = require('vows'),
Fuse = require('fuse')
var verbose = false
vows.describe('Flat list of strings: ["Apple", "Orange", "Banana"]').addBatch({
'Flat:': {
topic: function () {
var fruits = ['Apple', 'Orange', 'Banana']
var fuse = new Fuse(fruits, {
verbose: verbose
})
return fuse
},
'When searching for the term "Apple"': {
topic: function (fuse) {
var result = fuse.search('Apple')
return result
},
'we get a list of containing 1 item, which is an exact match': function (result) {
assert.equal(result.length, 1)
},
'whose value is the index 0, representing ["Apple"]': function (result) {
assert.equal(result[0], 0)
},
},
'When performing a fuzzy search for the term "ran"': {
topic: function (fuse) {
var result = fuse.search('ran')
return result