| 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
 | import actions from '../../../app/javascript/routes/actions'
describe('actions', () => {
  it('should create an action to add a stop', () => {
    const expectedAction = {
      type: 'ADD_STOP',
    }
    expect(actions.addStop()).toEqual(expectedAction)
  })
})
describe('actions', () => {
  it('should create an action to move up a stop', () => {
    const index = 1
    const expectedAction = {
      type: 'MOVE_STOP_UP',
      index
    }
    expect(actions.moveStopUp(index)).toEqual(expectedAction)
  })
})
describe('actions', () => {
  it('should create an action to move down a stop', () => {
    const index = 1
    const expectedAction = {
      type: 'MOVE_STOP_DOWN',
      index
    }
    expect(actions.moveStopDown(index)).toEqual(expectedAction)
  })
})
describe('actions', () => {
  it('should create an action to delete a stop', () => {
    const index = 1
    const expectedAction = {
      type: 'DELETE_STOP',
      index
    }
    expect(actions.deleteStop(index)).toEqual(expectedAction)
  })
})
describe('actions', () => {
  it('should create an action to update the value of a stop', () => {
    const text = 'updated text'
    const index = 1
    const expectedAction = {
      type: 'UPDATE_INPUT_VALUE',
      index,
      text
    }
    expect(actions.updateInputValue(index, text)).toEqual(expectedAction)
  })
})
describe('actions', () => {
  it('should create an action to update the up select of a stop', () => {
    const event = {
      currentTarget: {
        value: 'forbidden',
        id: 'up'
      }
    }
    const index = 1
    const expectedAction = {
      type :'UPDATE_SELECT_VALUE',
      select_id: 'up',
      select_value: 'forbidden',
      index
    }
    expect(actions.updateSelectValue(event, index)).toEqual(expectedAction)
  })
})
describe('actions', () => {
  it('should create an action to toggle the map', () => {
    const index = 1
    const expectedAction = {
      type: 'TOGGLE_MAP',
      index
    }
    expect(actions.toggleMap(index)).toEqual(expectedAction)
  })
})
describe('actions', () => {
  it('should create an action to select a marker on the map', () => {
    const index = 1
    const data = {
      geometry: undefined,
      registration_number: 'rn_test',
      stoparea_id: 'sid_test',
      text: 't_test',
      user_objectid: 'uoid_test'
    }
    const expectedAction = {
      type: 'SELECT_MARKER',
      index,
      data
    }
    expect(actions.selectMarker(index, data)).toEqual(expectedAction)
  })
})
 |