|
7 | 7 | } from '../../../src'; |
8 | 8 | import { LogMock } from '../../helper/logMock'; |
9 | 9 |
|
10 | | -jest.mock('../../../src/state/state.persistent'); |
11 | | - |
12 | 10 | describe('State Tests', () => { |
13 | 11 | let dummyAgile: Agile; |
14 | 12 |
|
@@ -164,29 +162,13 @@ describe('State Tests', () => { |
164 | 162 | numberState.observers['output'] = dummyOutputObserver; |
165 | 163 | }); |
166 | 164 |
|
167 | | - it('should update existing Key in all instances', () => { |
| 165 | + it('should update the key indicator of the State and all associated Observers', () => { |
168 | 166 | numberState.setKey('newKey'); |
169 | 167 |
|
170 | 168 | expect(numberState._key).toBe('newKey'); |
171 | 169 | expect(numberState.observers['value']._key).toBe('newKey'); |
172 | 170 | expect(numberState.observers['output']._key).toBe('newKey'); |
173 | 171 | }); |
174 | | - |
175 | | - it("should update existing Key in all instances except persistent if the StateKey and PersistKey aren't equal", () => { |
176 | | - numberState.setKey('newKey'); |
177 | | - |
178 | | - expect(numberState._key).toBe('newKey'); |
179 | | - expect(numberState.observers['value']._key).toBe('newKey'); |
180 | | - expect(numberState.observers['output']._key).toBe('newKey'); |
181 | | - }); |
182 | | - |
183 | | - it('should update existing Key in all instances except persistent if new StateKey is undefined', () => { |
184 | | - numberState.setKey(undefined); |
185 | | - |
186 | | - expect(numberState._key).toBeUndefined(); |
187 | | - expect(numberState.observers['value']._key).toBeUndefined(); |
188 | | - expect(numberState.observers['output']._key).toBeUndefined(); |
189 | | - }); |
190 | 172 | }); |
191 | 173 |
|
192 | 174 | describe('set function tests', () => { |
@@ -249,10 +231,9 @@ describe('State Tests', () => { |
249 | 231 |
|
250 | 232 | LogMock.hasNotLogged('warn'); |
251 | 233 | LogMock.hasNotLogged('error'); |
252 | | - expect(numberState.observers['value'].ingestValue).toHaveBeenCalledWith( |
253 | | - 'coolValue', |
254 | | - { force: false } |
255 | | - ); |
| 234 | + expect( |
| 235 | + numberState.observers['value'].ingestValue |
| 236 | + ).toHaveBeenCalledWith('coolValue', { force: false }); |
256 | 237 | }); |
257 | 238 | }); |
258 | 239 |
|
|
0 commit comments