Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit e7e4526

Browse files
committed
rework formatting of ticket
1 parent deb8a23 commit e7e4526

File tree

3 files changed

+13
-13
lines changed

3 files changed

+13
-13
lines changed

.eslintrc.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ module.exports = {
1818
"brace-style": "error",
1919
"callback-return": "error",
2020
"camelcase": "error",
21-
"capitalized-comments": "error",
21+
"capitalized-comments": "off",
2222
"class-methods-use-this": "error",
2323
"comma-dangle": "off",
2424
"comma-spacing": [

support.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ const actions = [
3232
},
3333
{
3434
action: (data, message, content) =>
35-
ticket.openTicket(data.tickets, message, content),
35+
ticket.openTicket(data.tickets, message, content.trim()),
3636
regexp: /please (.*)/i,
3737
reply: (message, output) => `will ${output.content} (ticket #${output.id})`,
3838
},
@@ -85,9 +85,9 @@ const actions = [
8585
reply: (message, output) => ticket.showTickets(output, ['open', 'closed']),
8686
},
8787
{
88-
action: (data, _message) => ticket.forget(data.tickets),
89-
regexp: /forget it/i,
90-
reply: (message, output) => `deleted ${output} tickets`,
88+
action: (data, _message, id) => ticket.forgetTicket(data.tickets, id),
89+
regexp: /forget #?([0-9]*)/i,
90+
reply: (message, output) => `deleted ticket #${output}`,
9191
},
9292
{
9393
action: (_data, _message, _type) => true,

test/support_test.js

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -104,9 +104,9 @@ describe('support', function() {
104104

105105
it('forget it', function() {
106106
const data = oneTicket()
107-
const reply = support.process(data, message('forget it'))
108-
assert.equal(reply, '#cando: deleted 1 tickets')
109-
assert.equal(data.tickets.lastId, 0)
107+
const reply = support.process(data, message('forget #1'))
108+
assert.equal(reply, '#cando: deleted ticket #1')
109+
assert.equal(data.tickets.lastId, 1)
110110
})
111111

112112
it('gimme a compliment', function() {
@@ -145,19 +145,19 @@ describe('support', function() {
145145

146146
it('TODO with ticket specific mine', function() {
147147
const reply = support.process(twoTickets(), message('mine'))
148-
assert.match(reply, /ticket #1/)
149-
assert.notMatch(reply, /ticket #2/)
148+
assert.match(reply, /#1: Ricky/)
149+
assert.notMatch(reply, /#2/)
150150
})
151151

152152
it('TODO with ticket specific other user', function() {
153153
const reply = support.process(twoTickets(), message('TODO dmitry'))
154-
assert.notMatch(reply, /ticket #1/)
155-
assert.match(reply, /ticket #2/)
154+
assert.notMatch(reply, /#1/)
155+
assert.match(reply, /#2/)
156156
})
157157

158158
it('Add comment to ticket', function() {
159159
const reply = support.process(oneTicket(), message('ticket #1 do not forget to get different colors'))
160-
assert.match(reply, /ticket #1/)
160+
assert.match(reply, /#1/)
161161
assert.match(reply, /do not forget to get different colors/)
162162
})
163163

0 commit comments

Comments
 (0)