aboutsummaryrefslogtreecommitdiff
path: root/src/stores/actions.test.js
blob: c6505369b259631a8610dc249397f3ed1b9336f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
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);
    })();
  });
});