]> git.r.bdr.sh - rbdr/forum/blob - src/stores/actions.test.js
Add tests for actions + pacts for graphql errrors
[rbdr/forum] / src / stores / actions.test.js
1 import { enableTopicActions, disableTopicActions, topicActions } from './actions';
2
3 describe('Topic actions and state', () => {
4
5 test('There should be no topic actions by default', () => {
6
7 topicActions.subscribe((actions) => {
8
9 expect(actions).toBe(undefined);
10 })();
11 });
12
13 test('enableTopicActions should set the topic id', () => {
14
15 enableTopicActions('free_hat');
16 topicActions.subscribe((actions) => {
17
18 expect(actions).toEqual({
19 id: 'free_hat'
20 });
21 })();
22 });
23
24 test('disableTopicActions should unset the topic id', () => {
25
26 disableTopicActions();
27 topicActions.subscribe((actions) => {
28
29 expect(actions).toEqual(undefined);
30 })();
31 });
32 });