Skip to content

Commit

Permalink
create tests/message/slack.bats (fixes #2110) (#2111)
Browse files Browse the repository at this point in the history
Co-authored-by: dogi <[email protected]>
  • Loading branch information
JLKwong and dogi authored Mar 29, 2021
1 parent e6f025c commit e73b306
Show file tree
Hide file tree
Showing 2 changed files with 35 additions and 1 deletion.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@treehouses/cli",
"version": "1.25.35",
"version": "1.25.36",
"remote": "4000",
"description": "Thin command-line interface for Raspberry Pi low level configuration.",
"main": "cli.sh",
Expand Down
34 changes: 34 additions & 0 deletions tests/message/slack.bats
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
#!/usr/bin/env bats
load ../test-helper

@test "$clinom message slack apitoken" {
run "${clicmd}" message slack apitoken
assert_success
}

@test "$clinom message slack apitoken (create invalid token)" {
run "${clicmd}" message slack apitoken fake-token
assert_output --partial 'invalid token'
}

@test "$clinom message slack apitoken (no token)" {
run "${clicmd}" message slack apitoken
assert_output --partial 'api.slack.com/apps'
}

@test "$clinom message slack apitoken (create token)" {
run "${clicmd}" message slack apitoken xoxp-fake-token
assert_output --partial 'Your slack apitoken'
}

@test "$clinom message slack apitoken (overrite token)" {
run "${clicmd}" message slack apitoken xoxp-fake-token
run "${clicmd}" message slack apitoken xoxp-another-fake-token
assert_output --partial 'Your slack apitoken (xoxp-another-fake-token)'
}

@test "$clinom message slack apitoken (with token)" {
run "${clicmd}" message slack apitoken xoxp-fake-token
run "${clicmd}" message slack apitoken
assert_output --partial 'Your API access token is'
}

0 comments on commit e73b306

Please sign in to comment.