本文整理匯總了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