Skip to content

Commit d6596ca

Browse files
committed
candra -> cando
1 parent 662623e commit d6596ca

6 files changed

+48
-14
lines changed

.vscode/launch.json

+32
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
{
2+
// Use IntelliSense to learn about possible Node.js debug attributes.
3+
// Hover to view descriptions of existing attributes.
4+
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
5+
"version": "0.2.0",
6+
"configurations": [
7+
{
8+
"type": "node2",
9+
"request": "launch",
10+
"name": "Launch Program",
11+
"program": "${workspaceRoot}/app.js",
12+
"cwd": "${workspaceRoot}"
13+
},
14+
{
15+
"name": "Run mocha",
16+
"type": "node",
17+
"request": "launch",
18+
"program": "${workspaceRoot}/node_modules/mocha/bin/_mocha",
19+
"stopOnEntry": false,
20+
"args": ["test/**/*.js", "--no-timeouts"],
21+
"cwd": "${workspaceRoot}",
22+
"runtimeExecutable": null,
23+
"env": { "NODE_ENV": "testing"}
24+
},
25+
{
26+
"type": "node",
27+
"request": "attach",
28+
"name": "Attach to Process",
29+
"port": 5858
30+
}
31+
]
32+
}

config.json.example

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"prefix": "candra",
2+
"prefix": "cando",
33
"whitelisted": [
44
"Agora Space #3:bunker",
55
"Agora - management",

package.json

+3-1
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,9 @@
1818
"test": "node_modules/.bin/mocha",
1919
"start": "node bot.js",
2020
"lint": "node_modules/eslint/bin/eslint.js *.js",
21-
"validate": "npm ls"
21+
"validate": "npm ls",
22+
"watch": "node_modules/.bin/mocha --watch"
23+
2224
},
2325
"pre-commit": [
2426
"lint",

support.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -298,7 +298,7 @@ function load(storePath) {
298298
return JSON.parse(datastore)
299299
} catch(e) {
300300
if(e instanceof SyntaxError) {
301-
throw new TicketError(`invalid content of file: ${storePath}`)
301+
throw new TicketError(`invalid content of file: ${storePath}`)
302302
} else {
303303
throw e
304304
}

test/handler_test.js

+4-4
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ const TEST_FILE = tmp.tmpNameSync()
2424

2525
const config = {
2626
'management': 'Agora - management',
27-
'prefix': 'candra',
27+
'prefix': 'cando',
2828
'processor': './support.js',
2929
'store': TEST_FILE,
3030
'whitelisted': [
@@ -43,17 +43,17 @@ describe('handler', function() {
4343
const message = createWeChatyMessage(
4444
'Ricky',
4545
'test room',
46-
'candra please add ticket',
46+
'cando please add ticket',
4747
say)
4848

4949
// First ticket
5050
handler(config, data, message)
51-
assert.equal(sayValue, '#candra: will add ticket (ticket #1)')
51+
assert.equal(sayValue, '#cando: will add ticket (ticket #1)')
5252
assert.instanceOf(data.tickets['1'], Object)
5353

5454
// Second ticket
5555
handler(config, data, message)
56-
assert.equal(sayValue, '#candra: will add ticket (ticket #2)')
56+
assert.equal(sayValue, '#cando: will add ticket (ticket #2)')
5757
assert.equal(data.tickets.lastId, 2)
5858
assert.instanceOf(data.tickets['2'], Object)
5959
})

test/support_test.js

+7-7
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ const tmp = require('tmp');
66

77
const sample = {
88
content: 'please get markers',
9-
prefix: 'candra',
9+
prefix: 'cando',
1010
roomName: 'MyRoom',
1111
userName: 'Ricky',
1212
}
@@ -67,23 +67,23 @@ const TEST_FILE = tmp.fileSync().name
6767
describe('support', function() {
6868
it('ping', function() {
6969
const reply = support.process(oneTicket(), message(''))
70-
assert.equal(reply, '#candra: Yes Ricky?')
70+
assert.equal(reply, '#cando: Yes Ricky?')
7171
})
7272

7373
it('close', function() {
7474
const reply = support.process(oneTicket(), message('close #1'))
75-
assert.equal(reply, '#candra: ticket #1 is closed')
75+
assert.equal(reply, '#cando: ticket #1 is closed')
7676
})
7777

7878
it('debug', function() {
7979
const tickets = oneTicket()
8080
const reply = support.process(tickets, message('debug'))
81-
assert.deepEqual(JSON.parse(reply.slice('#candra: '.length)), tickets)
81+
assert.deepEqual(JSON.parse(reply.slice('#cando: '.length)), tickets)
8282
})
8383

8484
it('invalid', function() {
8585
const reply = support.process(oneTicket(), message('handsome'))
86-
assert.equal(reply, '#candra: I don\'t understand: handsome, can you try again?')
86+
assert.equal(reply, '#cando: I don\'t understand: handsome, can you try again?')
8787
})
8888

8989
it('help', function() {
@@ -94,7 +94,7 @@ describe('support', function() {
9494
it('forget it', function() {
9595
const tickets = oneTicket()
9696
const reply = support.process(tickets, message('forget it'))
97-
assert.equal(reply, '#candra: deleted 1 tickets')
97+
assert.equal(reply, '#cando: deleted 1 tickets')
9898
assert.equal(tickets.lastId, 0)
9999
})
100100

@@ -115,7 +115,7 @@ describe('support', function() {
115115

116116
it('TODO empty', function() {
117117
const reply = support.process({}, message('todo'))
118-
assert.equal(reply, '#candra: nothing TODO!')
118+
assert.equal(reply, '#cando: nothing TODO!')
119119
})
120120

121121
it('TODO with ticket specific mine', function() {

0 commit comments

Comments
 (0)