(location: LocationConfig | undefined)
| 259 | } |
| 260 | |
| 261 | function parseLocationConfig(location: LocationConfig | undefined): InitialEntry { |
| 262 | if (!location) { |
| 263 | return LocationFixture().pathname; |
| 264 | } |
| 265 | |
| 266 | if (!location.query && !location.state) { |
| 267 | return location.pathname; |
| 268 | } |
| 269 | |
| 270 | const config: InitialEntry = { |
| 271 | pathname: location.pathname, |
| 272 | }; |
| 273 | |
| 274 | if (location.query) { |
| 275 | config.search = parseQueryString(location.query); |
| 276 | } |
| 277 | |
| 278 | if (location.state) { |
| 279 | config.state = location.state; |
| 280 | } |
| 281 | |
| 282 | return config; |
| 283 | } |
| 284 | |
| 285 | function parseQueryString(query: Record<string, string | number | string[]> | undefined) { |
| 286 | if (!query) { |
no test coverage detected