10000 Update example. · javascriptit/examples-1@3e39ba2 · GitHub
[go: up one dir, main page]

Skip to content

Commit 3e39ba2

Browse files
committed
Update example.
1 parent e769e9b commit 3e39ba2

File tree

2 files changed

+22
-15
lines changed

2 files changed

+22
-15
lines changed

assertion-testing/readme.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,4 @@
1+
# Unit-Testing
2+
3+
- Total.js `+v2.7.0`
4+
- run `$ node test.js`

assertion-testing/tests/default.js

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,24 @@
1-
exports.run = function() {
1+
TEST('controller.increment()', function() {
2+
FAIL(F.controller('default').functions.increment(1) !== 2);
3+
});
24

3-
F.assert('controller.increment()', function(next, name) {
4-
assert.ok(F.controller('default').functions.increment(1) === 2, name);
5-
next();
5+
TEST('Test URL 1', '/1/', function(builder) {
6+
builder.get();
7+
builder.exec(function(err, response, output) {
8+
FAIL(output.response !== '1', name);
69
});
10+
});
711

8-
F.assert('Test URL 1', '/1/', ['get'], function(error, data, code, headers, cookies, name) {
9-
assert.ok(code === 200 && data === '1', name);
12+
TEST('Test URL 2', '/2/', function(builder) {
13+
builder.get();
14+
builder.exec(function(err, response, output) {
15+
FAIL(output.response !== '2', name);
1016
});
17+
});
1118

12-
F.assert('Test URL 2', '/2/', ['get'], function(error, data, code, headers, cookies, name) {
13-
assert.ok(code === 200 && data === '2', name);
19+
TEST('Test URL 3', '/3/', function(builder) {
20+
builder.json({ data: 4 });
21+
builder.exec(function(err, response) {
22+
FAIL(response.data !== 3, name);
1423
});
15-
16-
F.assert('Test URL 3', '/3/', ['post', 'json'], function(error, data, code, headers, cookies, name) {
17-
// throws error, data === 4
18-
assert.ok(code === 200 && JSON.parse(data).data === 3, name);
19-
}, { data: 4 });
20-
21-
};
24+
});

0 commit comments

Comments
 (0)
0