summaryrefslogtreecommitdiff
path: root/history/modules/__tests__/TestSequences/GoForward.js
blob: 06d7f61af48040d91c72cfb9e66e4c0c2ab1e9f1 (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
33
34
35
36
37
38
39
import expect from 'expect';

import execSteps from './execSteps.js';

export default function(history, done) {
  const steps = [
    location => {
      expect(location).toMatchObject({
        pathname: '/'
      });

      history.push('/home');
    },
    (location, action) => {
      expect(action).toEqual('PUSH');
      expect(location).toMatchObject({
        pathname: '/home'
      });

      history.goBack();
    },
    (location, action) => {
      expect(action).toEqual('POP');
      expect(location).toMatchObject({
        pathname: '/'
      });

      history.goForward();
    },
    (location, action) => {
      expect(action).toEqual('POP');
      expect(location).toMatchObject({
        pathname: '/home'
      });
    }
  ];

  execSteps(steps, history, done);
}