]> git.r.bdr.sh - rbdr/forum/blob - src/lib/stores/actions.test.ts
c6505369b259631a8610dc249397f3ed1b9336f1
[rbdr/forum] / src / lib / stores / actions.test.ts
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 });