|
1 | 1 | import { createMemoryHistory } from '../../src/history/memory' |
2 | | -import { START, HistoryLocation, HistoryState } from '../../src/history/common' |
| 2 | +import { START, HistoryLocation } from '../../src/history/common' |
3 | 3 | import { vi, describe, expect, it } from 'vitest' |
4 | 4 |
|
5 | 5 | const loc: HistoryLocation = '/foo' |
6 | 6 |
|
7 | 7 | const loc2: HistoryLocation = '/bar' |
8 | 8 |
|
9 | | -const state: HistoryState = { foo: 'bar' } |
10 | | - |
11 | | -const state2: HistoryState = { foo: 'baz' } |
12 | | - |
13 | 9 | describe('Memory history', () => { |
14 | 10 | it('starts in nowhere', () => { |
15 | 11 | const history = createMemoryHistory() |
@@ -57,12 +53,12 @@ describe('Memory history', () => { |
57 | 53 |
|
58 | 54 | it('stores a state', () => { |
59 | 55 | const history = createMemoryHistory() |
60 | | - history.push(loc, state) |
61 | | - expect(history.state).toEqual(state) |
62 | | - history.push(loc, state2) |
63 | | - expect(history.state).toEqual(state2) |
| 56 | + history.push(loc, { foo: 'bar' }) |
| 57 | + expect(history.state).toEqual({ foo: 'bar' }) |
| 58 | + history.push(loc, { foo: 'baz' }) |
| 59 | + expect(history.state).toEqual({ foo: 'baz' }) |
64 | 60 | history.go(-1) |
65 | | - expect(history.state).toEqual(state) |
| 61 | + expect(history.state).toEqual({ foo: 'bar' }) |
66 | 62 | }) |
67 | 63 |
|
68 | 64 | it('does nothing with back if queue contains only one element', () => { |
|
0 commit comments