-
Notifications
You must be signed in to change notification settings - Fork 37
Expand file tree
/
Copy pathchai-demo-assertions.js
More file actions
41 lines (29 loc) · 910 Bytes
/
chai-demo-assertions.js
File metadata and controls
41 lines (29 loc) · 910 Bytes
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
/**
* Part of a course on Hyperledger Fabric:
* http://ACloudFan.com
*
* Last Updated: Dec 21, 2018
*
* This demonstrates the use of Chai Assertion Library
* http://chaijs.com/
*
* Test:
* mocha test chai-demo-assertions.js
*
*/
var assert = require('chai').assert;
// This statement is for Mocha test suite
describe('Suite-1',()=>{
it('Test case # 1 *Assertion* style',()=>{
// Test case passes if expression evaluates to true
assert(true);
// .equal(actual, expected, [message])
assert.equal(true, true, 'otherwise problem');
// .exists(value, [message])
assert.exists(true, 'otherwise problem');
// .operator(val1, operator, val2, [message])
assert.operator(10, ">", 5, 'otherwise problem');
// Check the documentation here for complete list
// http://chaijs.com/api/assert/
});
});