From e73b3065454306c93b506370435ce730538dea7c Mon Sep 17 00:00:00 2001 From: JLKwong <61807745+JLKwong@users.noreply.github.com> Date: Mon, 29 Mar 2021 13:56:56 -0700 Subject: [PATCH] create `tests/message/slack.bats` (fixes #2110) (#2111) Co-authored-by: dogi --- package.json | 2 +- tests/message/slack.bats | 34 ++++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+), 1 deletion(-) create mode 100755 tests/message/slack.bats diff --git a/package.json b/package.json index 9be1d3578e..20f1713e8c 100644 --- a/package.json +++ b/package.json @@ -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", diff --git a/tests/message/slack.bats b/tests/message/slack.bats new file mode 100755 index 0000000000..38dbb5e2be --- /dev/null +++ b/tests/message/slack.bats @@ -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' +}