Skip to content

Commit e73b306

Browse files
JLKwongdogi
andauthored
create tests/message/slack.bats (fixes #2110) (#2111)
Co-authored-by: dogi <dogi@users.noreply.github.com>
1 parent e6f025c commit e73b306

File tree

2 files changed

+35
-1
lines changed

2 files changed

+35
-1
lines changed

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"name": "@treehouses/cli",
3-
"version": "1.25.35",
3+
"version": "1.25.36",
44
"remote": "4000",
55
"description": "Thin command-line interface for Raspberry Pi low level configuration.",
66
"main": "cli.sh",

tests/message/slack.bats

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
#!/usr/bin/env bats
2+
load ../test-helper
3+
4+
@test "$clinom message slack apitoken" {
5+
run "${clicmd}" message slack apitoken
6+
assert_success
7+
}
8+
9+
@test "$clinom message slack apitoken (create invalid token)" {
10+
run "${clicmd}" message slack apitoken fake-token
11+
assert_output --partial 'invalid token'
12+
}
13+
14+
@test "$clinom message slack apitoken (no token)" {
15+
run "${clicmd}" message slack apitoken
16+
assert_output --partial 'api.slack.com/apps'
17+
}
18+
19+
@test "$clinom message slack apitoken (create token)" {
20+
run "${clicmd}" message slack apitoken xoxp-fake-token
21+
assert_output --partial 'Your slack apitoken'
22+
}
23+
24+
@test "$clinom message slack apitoken (overrite token)" {
25+
run "${clicmd}" message slack apitoken xoxp-fake-token
26+
run "${clicmd}" message slack apitoken xoxp-another-fake-token
27+
assert_output --partial 'Your slack apitoken (xoxp-another-fake-token)'
28+
}
29+
30+
@test "$clinom message slack apitoken (with token)" {
31+
run "${clicmd}" message slack apitoken xoxp-fake-token
32+
run "${clicmd}" message slack apitoken
33+
assert_output --partial 'Your API access token is'
34+
}

0 commit comments

Comments
 (0)