@@ -2,13 +2,21 @@ import { describe, it, expect } from 'vitest';
2
2
3
3
import { ArrivalTimeTypes , StdcmStopTypes } from 'applications/stdcm/types' ;
4
4
import {
5
- addNewStdcmResult ,
6
- retainSimulation ,
7
- selectSimulation ,
8
5
stdcmConfInitialState ,
9
6
stdcmConfSlice ,
10
- stdcmConfSliceActions ,
11
7
updateLastStdcmResult ,
8
+ resetStdcmConfig ,
9
+ updateGridMarginAfter ,
10
+ updateGridMarginBefore ,
11
+ updateMaxSpeed ,
12
+ updateStandardAllowance ,
13
+ updateStdcmPathStep ,
14
+ updateTotalLength ,
15
+ updateTotalMass ,
16
+ updateTowedRollingStockID ,
17
+ addNewStdcmResult ,
18
+ retainSimulation ,
19
+ selectSimulation ,
12
20
} from 'reducers/osrdconf/stdcmConf' ;
13
21
import type { OsrdStdcmConfState , StandardAllowance , StdcmPathStep } from 'reducers/osrdconf/types' ;
14
22
import { createStoreWithoutMiddleware } from 'store' ;
@@ -83,7 +91,7 @@ describe('stdcmConfReducers', () => {
83
91
expect ( stateBefore . margins . standardAllowance ) . toBe ( initialTimeStandardAllowance ) ;
84
92
85
93
const newStandardAllowance = testDataBuilder . buildPercentageStandardAllowance ( 5 ) ;
86
- store . dispatch ( stdcmConfSliceActions . updateStandardAllowance ( newStandardAllowance ) ) ;
94
+ store . dispatch ( updateStandardAllowance ( newStandardAllowance ) ) ;
87
95
88
96
const stateAfter = store . getState ( ) [ stdcmConfSlice . name ] ;
89
97
expect ( stateAfter . margins . standardAllowance ) . toBe ( newStandardAllowance ) ;
@@ -92,23 +100,23 @@ describe('stdcmConfReducers', () => {
92
100
it ( 'should handle updateGridMarginBefore' , ( ) => {
93
101
const newGridMarginBefore = 5 ;
94
102
const store = createStore ( initialStateSTDCMConfig ) ;
95
- store . dispatch ( stdcmConfSliceActions . updateGridMarginBefore ( newGridMarginBefore ) ) ;
103
+ store . dispatch ( updateGridMarginBefore ( newGridMarginBefore ) ) ;
96
104
const state = store . getState ( ) [ stdcmConfSlice . name ] ;
97
105
expect ( state . margins . gridMarginBefore ) . toStrictEqual ( newGridMarginBefore ) ;
98
106
} ) ;
99
107
100
108
it ( 'should handle updateGridMarginAfter' , ( ) => {
101
109
const newGridMarginAfter = 5 ;
102
110
const store = createStore ( initialStateSTDCMConfig ) ;
103
- store . dispatch ( stdcmConfSliceActions . updateGridMarginAfter ( newGridMarginAfter ) ) ;
111
+ store . dispatch ( updateGridMarginAfter ( newGridMarginAfter ) ) ;
104
112
const state = store . getState ( ) [ stdcmConfSlice . name ] ;
105
113
expect ( state . margins . gridMarginAfter ) . toStrictEqual ( newGridMarginAfter ) ;
106
114
} ) ;
107
115
} ) ;
108
116
109
117
it ( 'should handle resetStdcmConfig' , ( ) => {
110
118
const store = createStore ( initialStateSTDCMConfig ) ;
111
- store . dispatch ( stdcmConfSliceActions . resetStdcmConfig ( ) ) ;
119
+ store . dispatch ( resetStdcmConfig ( ) ) ;
112
120
113
121
const state = store . getState ( ) [ stdcmConfSlice . name ] ;
114
122
expect ( state . rollingStockID ) . toBe ( stdcmConfInitialState . rollingStockID ) ;
@@ -119,23 +127,23 @@ describe('stdcmConfReducers', () => {
119
127
describe ( 'Consist updates' , ( ) => {
120
128
const store = createStore ( ) ;
121
129
it ( 'should handle totalMass' , ( ) => {
122
- store . dispatch ( stdcmConfSliceActions . updateTotalMass ( 345 ) ) ;
130
+ store . dispatch ( updateTotalMass ( 345 ) ) ;
123
131
const state = store . getState ( ) [ stdcmConfSlice . name ] ;
124
132
expect ( state . totalMass ) . toEqual ( 345 ) ;
125
133
} ) ;
126
134
127
135
it ( 'should handle totalLength' , ( ) => {
128
- store . dispatch ( stdcmConfSliceActions . updateTotalLength ( 345 ) ) ;
136
+ store . dispatch ( updateTotalLength ( 345 ) ) ;
129
137
const state = store . getState ( ) [ stdcmConfSlice . name ] ;
130
138
expect ( state . totalLength ) . toEqual ( 345 ) ;
131
139
} ) ;
132
140
it ( 'should handle maxSpeed' , ( ) => {
133
- store . dispatch ( stdcmConfSliceActions . updateMaxSpeed ( 110 ) ) ;
141
+ store . dispatch ( updateMaxSpeed ( 110 ) ) ;
134
142
const state = store . getState ( ) [ stdcmConfSlice . name ] ;
135
143
expect ( state . maxSpeed ) . toEqual ( 110 ) ;
136
144
} ) ;
137
145
it ( 'should handle towedRollingStockID' , ( ) => {
138
- store . dispatch ( stdcmConfSliceActions . updateTowedRollingStockID ( 11 ) ) ;
146
+ store . dispatch ( updateTowedRollingStockID ( 11 ) ) ;
139
147
const state = store . getState ( ) [ stdcmConfSlice . name ] ;
140
148
expect ( state . towedRollingStockID ) . toEqual ( 11 ) ;
141
149
} ) ;
@@ -156,7 +164,7 @@ describe('stdcmConfReducers', () => {
156
164
} ,
157
165
} ;
158
166
159
- store . dispatch ( stdcmConfSliceActions . updateStdcmPathStep ( { id : origin . id , updates } ) ) ;
167
+ store . dispatch ( updateStdcmPathStep ( { id : origin . id , updates } ) ) ;
160
168
const state = store . getState ( ) [ stdcmConfSlice . name ] ;
161
169
expect ( state . stdcmPathSteps . at ( 0 ) ) . toEqual ( { ...origin , ...updates } ) ;
162
170
} ) ;
@@ -169,7 +177,7 @@ describe('stdcmConfReducers', () => {
169
177
stopFor : 1 ,
170
178
} ;
171
179
172
- store . dispatch ( stdcmConfSliceActions . updateStdcmPathStep ( { id : via . id , updates } ) ) ;
180
+ store . dispatch ( updateStdcmPathStep ( { id : via . id , updates } ) ) ;
173
181
const state = store . getState ( ) [ stdcmConfSlice . name ] ;
174
182
expect ( state . stdcmPathSteps . at ( 1 ) ) . toEqual ( { ...via , ...updates } ) ;
175
183
} ) ;
@@ -186,7 +194,7 @@ describe('stdcmConfReducers', () => {
186
194
} ,
187
195
} ;
188
196
189
- store . dispatch ( stdcmConfSliceActions . updateStdcmPathStep ( { id : destination . id , updates } ) ) ;
197
+ store . dispatch ( updateStdcmPathStep ( { id : destination . id , updates } ) ) ;
190
198
const state = store . getState ( ) [ stdcmConfSlice . name ] ;
191
199
expect ( state . stdcmPathSteps . at ( - 1 ) ) . toEqual ( { ...destination , ...updates } ) ;
192
200
} ) ;
0 commit comments