aboutsummaryrefslogtreecommitdiff
path: root/src/lib/stores/actions.test.ts
diff options
context:
space:
mode:
authorRuben Beltran del Rio <ruben@unlimited.pizza>2022-05-01 00:56:06 +0200
committerRuben Beltran del Rio <ruben@unlimited.pizza>2022-05-01 00:56:06 +0200
commita7cf03c192470cbab13edeb1aec99e0c66dede10 (patch)
tree581b4430d1de958dcb666bae80a7678332134602 /src/lib/stores/actions.test.ts
parent010f307346e525ac2e4239a0549d2c1a4d6d102b (diff)
Update / use typescript
Diffstat (limited to 'src/lib/stores/actions.test.ts')
-rw-r--r--src/lib/stores/actions.test.ts32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/lib/stores/actions.test.ts b/src/lib/stores/actions.test.ts
new file mode 100644
index 0000000..c650536
--- /dev/null
+++ b/src/lib/stores/actions.test.ts
@@ -0,0 +1,32 @@
+import { enableTopicActions, disableTopicActions, topicActions } from './actions';
+
+describe('Topic actions and state', () => {
+
+ test('There should be no topic actions by default', () => {
+
+ topicActions.subscribe((actions) => {
+
+ expect(actions).toBe(undefined);
+ })();
+ });
+
+ test('enableTopicActions should set the topic id', () => {
+
+ enableTopicActions('free_hat');
+ topicActions.subscribe((actions) => {
+
+ expect(actions).toEqual({
+ id: 'free_hat'
+ });
+ })();
+ });
+
+ test('disableTopicActions should unset the topic id', () => {
+
+ disableTopicActions();
+ topicActions.subscribe((actions) => {
+
+ expect(actions).toEqual(undefined);
+ })();
+ });
+});