Skip to content

Commit 606fe9c

Browse files
test(overmind): add test for hot reload actions
1 parent 8e716d8 commit 606fe9c

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

packages/node_modules/overmind/src/index.test.ts

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,25 @@ describe('Overmind', () => {
394394
})
395395
expect(app.state.foo).toBe('bar2')
396396
})
397+
test('should rehydrate actions on hot reload', () => {
398+
expect.assertions(2)
399+
const app = createDefaultOvermind()
400+
const changeFoo = app.actions.changeFoo
401+
app.reconfigure({
402+
state: {
403+
foo: 'bar2'
404+
},
405+
actions: {
406+
changeFoo(context) {
407+
context.state.foo = 'replaced!'
408+
}
409+
}
410+
})
411+
412+
expect(app.state.foo).toBe('bar2')
413+
changeFoo()
414+
expect(app.state.foo).toBe('replaced!')
415+
})
397416
})
398417

399418
describe('Overmind mock', () => {

0 commit comments

Comments
 (0)