aboutsummaryrefslogtreecommitdiff
path: root/src/lib/stores/actions.test.ts
blob: 39e1f6eb22125bc7d1a23ebd5c403c484a32ff1e (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
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);
		})();
	});
});