effects.spec.ts 734 B

12345678910111213141516171819202122232425
  1. import { ActionStateSetRemote, ActionTypeLocal, ActionTypeRemote, stateSet } from '../actions';
  2. import { MusicPlayer } from '../types/state';
  3. import { globalEffects } from './effects';
  4. describe(globalEffects.name, () => {
  5. describe(ActionTypeLocal.StateSet, () => {
  6. it('should create a remote state set action', () => {
  7. expect.assertions(1);
  8. const localPlayer: MusicPlayer = {
  9. songId: 123,
  10. playing: false,
  11. playTimeSeconds: 83,
  12. currentClient: 'my-client',
  13. };
  14. const result = globalEffects(stateSet(localPlayer));
  15. expect(result).toStrictEqual<ActionStateSetRemote>({
  16. type: ActionTypeRemote.StateSet,
  17. payload: localPlayer,
  18. });
  19. });
  20. });
  21. });