From 26dfa00e2f4eddbdc71ae4d92ee5676f11413ada Mon Sep 17 00:00:00 2001 From: Ruben Beltran del Rio Date: Mon, 3 May 2021 20:59:55 +0200 Subject: Add tests for actions + pacts for graphql errrors --- src/stores/actions.test.js | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 src/stores/actions.test.js (limited to 'src/stores/actions.test.js') 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); + })(); + }); +}); -- cgit