Skip to content

Commit 108eaed

Browse files
committedSep 14, 2017
readme
1 parent bbbaae8 commit 108eaed

File tree

3 files changed

+31
-5
lines changed

3 files changed

+31
-5
lines changed
 

‎README.md

+16
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,22 @@ which, new messages are possibly `Sent`.
3535

3636
(KEY: A: asynchronous, S: synchronous, O: observed, C: consumed)
3737

38+
### Service interactions
39+
40+
![suggest](nodezoo-suggest.png?raw=true "suggest")
41+
42+
43+
## Testing
44+
45+
Unit tests are in the [test](test) folder. To run, use:
46+
47+
```sh
48+
$ npm run test
49+
```
50+
51+
Note that this is a learning system, and the tests are not intended to
52+
be high coverage.
53+
3854

3955
## Running from the terminal
4056

‎nodezoo-suggest.png

65.3 KB
Loading

‎test/suggest.test.js

+15-5
Original file line numberDiff line numberDiff line change
@@ -11,20 +11,30 @@ var expect = Code.expect
1111

1212

1313
describe('suggest', function () {
14-
14+
1515
it('query', function (done) {
1616
var q = 'q'+((''+Math.random()).substring(2))
17+
var q1 = q.substring(0,2)
18+
var q2 = q.substring(0,3)
1719

1820
Seneca()
1921
.test(done)
2022
.use('..')
2123
.gate()
22-
.act('role:suggest,cmd:add,query:'+q)
23-
.act('role:suggest,cmd:suggest,query:'+q.substring(0,q.length/2),
24+
25+
.act('role:suggest,cmd:add,query:'+q1)
26+
.act('role:suggest,cmd:suggest,query:'+q1.substring(0,1),
27+
function (ignore, out) {
28+
expect(out).to.equal([q1])
29+
})
30+
31+
.act('role:suggest,cmd:add,query:'+q2)
32+
.act('role:suggest,cmd:suggest,query:'+q1.substring(0,1),
2433
function (ignore, out) {
25-
expect(out[0]).to.equal(q)
26-
done()
34+
expect(out).to.equal([q1, q2])
2735
})
36+
37+
.ready(done)
2838
})
2939
})
3040

0 commit comments

Comments
 (0)
Please sign in to comment.