aboutsummaryrefslogtreecommitdiff
path: root/src/stores/actions.test.js
diff options
context:
space:
mode:
authorRuben Beltran del Rio <ruben@unlimited.pizza>2021-05-03 20:59:55 +0200
committerRuben Beltran del Rio <ruben@unlimited.pizza>2021-05-03 20:59:55 +0200
commit26dfa00e2f4eddbdc71ae4d92ee5676f11413ada (patch)
tree9df324ee7c3b9350e521018d35b0b18f5eef4fc9 /src/stores/actions.test.js
parent3435a35ccb828fe81720d057e38eaa4223e917a7 (diff)
Add tests for actions + pacts for graphql errrors
Diffstat (limited to 'src/stores/actions.test.js')
-rw-r--r--src/stores/actions.test.js32
1 files changed, 32 insertions, 0 deletions
diff --git a/src/stores/actions.test.js b/src/stores/actions.test.js
new file mode 100644
index 0000000..c650536
--- /dev/null
+++ b/src/stores/actions.test.js
@@ -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);
+ })();
+ });
+});