-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathmocha-demo.js
More file actions
63 lines (49 loc) · 1.23 KB
/
mocha-demo.js
File metadata and controls
63 lines (49 loc) · 1.23 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
/**
* Part of a course on Hyperledger Fabric:
* http://ACloudFan.com
*
* This demonstrates the use of Mocha Test Framework
* https://mochajs.org/
*
* By default all executions are asynchrnonous but using the done in callback one can
* change the behavior of the before/beforeEach/after to synchronous
*/
/**
* Suite of tests
*/
describe('Enclosing Suite', () => {
/**
* This is invoked before any test is executed
*/
// ASynchronous
before(() => {
// This gets executed asynchronously before every test suite
console.log("before() the test cases are executed");
});
/**
* This is invoked before any test is executed
*/
beforeEach(() => {
console.log("\tbeforeEach() executed");
});
// Test suite-1
describe('Suite-1', () => {
// Test case # 1
it('Test Case# 1', () => {
});
// Test case # 2
it('Test Case# 2', () => {
});
});
// Test suite-2
describe('Suite-2', () => {
it('Test Case# 1', () => {
});
});
/**
* This is invoked at the end of all the test execution
*/
after(() => {
console.log("after() executed");
});
});