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

refactor(react-query): parse api list for status table from build files #1113

Merged
merged 15 commits into from
Jul 23, 2024
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Prev Previous commit
test(react-query): add tests for package
  • Loading branch information
gwansikk committed Jul 23, 2024
commit 58961019dbd9deea6227bf6bbdc846d4e8bc3740
3 changes: 3 additions & 0 deletions packages/react-query/src/scripts/utils/commands.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import type { Mock, MockInstance } from 'vitest'
import packageJson from '../../../package.json'
import { fixAction, statusAction, switchAction } from './commands'
import {
getExportAPIsWithoutSuspensive,
getIndexFileContent,
getPackageJson,
getSuspensiveReactQueryPackageJson,
Expand Down Expand Up @@ -38,6 +39,8 @@ describe('commands', () => {
getTargetSuspensiveReactQueryVersionMock.mockReturnValue('5')
const getTargetSuspensiveReactQueryAPIsMock = getTargetSuspensiveReactQueryAPIs as Mock
getTargetSuspensiveReactQueryAPIsMock.mockReturnValue([])
const getExportAPIsWithoutSuspensiveMock = vi.mocked(getExportAPIsWithoutSuspensive)
getExportAPIsWithoutSuspensiveMock.mockReturnValue([])

vi.mocked(switchVersion).mockImplementation(() => {})
})
Expand Down
15 changes: 15 additions & 0 deletions packages/react-query/src/scripts/utils/package.spec.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,9 @@
import tanStackReactQueryPackageJson from '@tanstack/react-query/package.json'
import packageJson from '../../../package.json'
import {
getExportAPIsWithoutSuspensive,
getPackageJson,
getSuspensiveReactQueryPackageJson,
getTanStackReactQueryPackageJson,
getTargetSuspensiveReactQueryAPIs,
getTargetSuspensiveReactQueryVersion,
Expand Down Expand Up @@ -50,4 +52,17 @@ describe('package', () => {

expect(apis).toEqual(version4APIs)
})

it('should get the @suspensive/react-query package.json for version 4', () => {
const result = getSuspensiveReactQueryPackageJson('4')

expect(result).toBeDefined()
expect(result.name).toBe('@suspensive/react-query-4')
})

it('should get exported APIs without @suspensive/react-query', () => {
const apis = getExportAPIsWithoutSuspensive()

expect(apis).toEqual(expect.arrayContaining([]))
})
})
Loading