mirror of
https://github.com/zhigang1992/DefinitelyTyped.git
synced 2026-05-07 23:37:35 +08:00
Fleshed out some other ways to write tests with Nodeunit.
This commit is contained in:
@@ -14,10 +14,10 @@ var block: () =>{
|
||||
};
|
||||
|
||||
export var testGroup: nodeunit.ITestGroup = {
|
||||
setUp: function (callback: nodeunit.ICallbackFunction) {
|
||||
setUp: (callback) => {
|
||||
callback();
|
||||
},
|
||||
tearDown: function (callback: nodeunit.ICallbackFunction) {
|
||||
tearDown: (callback) => {
|
||||
callback();
|
||||
},
|
||||
test1: function (test: nodeunit.Test) {
|
||||
@@ -55,5 +55,83 @@ export var testGroup: nodeunit.ITestGroup = {
|
||||
|
||||
test.done(error);
|
||||
test.done();
|
||||
},
|
||||
"This is a test with a nice description": (test: nodeunit.Test) => {
|
||||
test.done();
|
||||
}
|
||||
};
|
||||
|
||||
|
||||
// see https://github.com/caolan/nodeunit/blob/master/examples/nested/nested_reporter_test.unit.js for example.
|
||||
// (https://github.com/caolan/nodeunit/commit/9fee91149324f79753eadbcf8993399a7d76da40)
|
||||
|
||||
|
||||
|
||||
var testCase = nodeunit.testCase;
|
||||
|
||||
export var testCaseGroup = testCase({
|
||||
"Test 0.1": function(test: nodeunit.Test) {
|
||||
test.ok(true);
|
||||
test.done();
|
||||
},
|
||||
|
||||
"TC 1": testCase({
|
||||
"TC 1.1": testCase({
|
||||
"Test 1.1.1": function(test: nodeunit.Test) {
|
||||
test.ok(true);
|
||||
test.done();
|
||||
}
|
||||
})
|
||||
}),
|
||||
|
||||
"TC 2": testCase({
|
||||
"TC 2.1": testCase({
|
||||
"TC 2.1.1": testCase({
|
||||
"Test 2.1.1.1": function(test: nodeunit.Test) {
|
||||
test.ok(true);
|
||||
test.done();
|
||||
},
|
||||
|
||||
"Test 2.1.1.2": function(test: nodeunit.Test) {
|
||||
test.ok(true);
|
||||
test.done();
|
||||
}
|
||||
}),
|
||||
|
||||
"TC 2.2.1": testCase({
|
||||
"Test 2.2.1.1": function(test: nodeunit.Test) {
|
||||
test.ok(true);
|
||||
test.done();
|
||||
},
|
||||
|
||||
"TC 2.2.1.1": testCase({
|
||||
"Test 2.2.1.1.1": function(test: nodeunit.Test) {
|
||||
test.ok(true);
|
||||
test.done();
|
||||
},
|
||||
}),
|
||||
|
||||
"Test 2.2.1.2": function(test: nodeunit.Test) {
|
||||
test.ok(true);
|
||||
test.done();
|
||||
}
|
||||
})
|
||||
})
|
||||
}),
|
||||
|
||||
"TC 3": testCase({
|
||||
"TC 3.1": testCase({
|
||||
"TC 3.1.1": testCase({
|
||||
"Test 3.1.1.1 (should fail)": function(test: nodeunit.Test) {
|
||||
test.ok(false);
|
||||
test.done();
|
||||
}
|
||||
})
|
||||
})
|
||||
})
|
||||
});
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user