Skip to content

Commit 2f57950

Browse files
zimegmwbrooks
andauthored
feat: add default app and manifest watch config (#89)
Co-authored-by: Michael Brooks <mbrooks@slack-corp.com>
1 parent ed1b892 commit 2f57950

File tree

2 files changed

+18
-7
lines changed

2 files changed

+18
-7
lines changed

slack_cli_hooks/hooks/get_hooks.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,17 @@
1818
"doctor": f"{EXEC} -m slack_cli_hooks.hooks.doctor",
1919
},
2020
"config": {
21-
"watch": {"filter-regex": "(^manifest\\.json$)", "paths": ["."]},
2221
"protocol-version": [MessageBoundaryProtocol.name, DefaultProtocol.name],
2322
"sdk-managed-connection-enabled": True,
23+
"watch": {
24+
"app": {
25+
"filter-regex": "\\.py$",
26+
"paths": ["."],
27+
},
28+
"manifest": {
29+
"paths": ["manifest.json"],
30+
},
31+
},
2432
},
2533
"runtime": "python",
2634
}

tests/slack_cli_hooks/hooks/test_get_hooks.py

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
import re
2-
31
from slack_cli_hooks.hooks.get_hooks import hooks_payload
42

53

@@ -18,13 +16,18 @@ def test_hooks_payload_config(self):
1816
assert config["sdk-managed-connection-enabled"] is True
1917
assert config["protocol-version"] == ["message-boundaries", "default"]
2018

21-
def test_hooks_watch_regex(self):
19+
def test_hooks_watch_app(self):
2220
config = hooks_payload["config"]
23-
2421
assert config["watch"] is not None
22+
assert config["watch"]["app"] is not None
23+
assert config["watch"]["app"]["filter-regex"] == "\\.py$"
24+
assert config["watch"]["app"]["paths"] == ["."]
2525

26-
filter_regex = config["watch"]["filter-regex"]
27-
assert re.match(filter_regex, "manifest.json") is not None
26+
def test_hooks_watch_manifest(self):
27+
config = hooks_payload["config"]
28+
assert config["watch"] is not None
29+
assert config["watch"]["manifest"] is not None
30+
assert config["watch"]["manifest"]["paths"] == ["manifest.json"]
2831

2932
def test_hooks_runtime(self):
3033
runtime = hooks_payload["runtime"]

0 commit comments

Comments
 (0)