Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

chore: clean up RouteParams type test structure #9573

Merged
merged 2 commits into from
Nov 27, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 6 additions & 8 deletions packages/router/src/__typetests__/routeParamsTypes.test.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { context, describe, expect, test } from 'tstyche'
import { describe, expect, test } from 'tstyche'

import type { RouteParams, ParamType } from '../routeParamsTypes'

Expand Down Expand Up @@ -90,14 +90,12 @@ describe('RouteParams<>', () => {
expect(globRoutes.description).type.toBeString()
})

context('Glob params in the middle', () => {
test('Multiple Glob route params', () => {
const middleGlob: RouteParams<'/repo/{folders...}/edit'> = {
folders: 'src/lib/auth.js',
}
test('Glob params in the middle', () => {
const middleGlob: RouteParams<'/repo/{folders...}/edit'> = {
folders: 'src/lib/auth.js',
}

Comment on lines -93 to +96
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@dac09 We had a conversation about this in #9394 already. I took a better look, seems like this is just a copy paste mistake.

The "Multiple Glob route params" test is defined above:

test('Multiple Glob route params', () => {
const globRoutes: RouteParams<'/from/{fromDate...}/to/{toDate...}'> = {

It tests multiple params indeed, but in the nested case only one param is tested. For me it looks that the nested "Multiple Glob route params" is redundant here. This test case is simply called "Glob params in the middle". Similar to "Starts with Glob route params" case above.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah agreed, looks that way to me too :)

Thank you for the PR again!

expect(middleGlob.folders).type.toBeString()
})
expect(middleGlob.folders).type.toBeString()
})

test('Mixed typed and untyped params', () => {
Expand Down
Loading