-
-
Notifications
You must be signed in to change notification settings - Fork 0
Codex-generated pull request #25
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
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -455,6 +455,7 @@ describe('usePublishedVariables', () => { | |
| token: null, | ||
| fileKey: null, | ||
| fallbackFile: mockPublishedVariablesResponse, | ||
| parsedFallbackFile: mockPublishedVariablesResponse, | ||
| } as ReturnType<typeof useFigmaTokenContextModule.useFigmaTokenContext>) | ||
|
|
||
| mockedUseSWR.mockReturnValue({ | ||
|
|
@@ -521,4 +522,36 @@ describe('usePublishedVariables', () => { | |
|
|
||
| spy.mockRestore() | ||
| }) | ||
|
||
|
|
||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Existing tests reference removed legacy fallback code pathMedium Severity The legacy Additional Locations (1) |
||
| it('should use live key when fallbackFile exists but parsedFallbackFile is invalid', () => { | ||
| const spy = vi | ||
| .spyOn(useFigmaTokenContextModule, 'useFigmaTokenContext') | ||
| .mockReturnValue({ | ||
| token: 'test-token', | ||
| fileKey: 'test-key', | ||
| fallbackFile: '{invalid-json}', | ||
| parsedFallbackFile: undefined, | ||
| providerId: 'test-provider', | ||
| } as ReturnType<typeof useFigmaTokenContextModule.useFigmaTokenContext>) | ||
|
|
||
| mockedUseSWR.mockReturnValue({ | ||
| data: undefined, | ||
| error: undefined, | ||
| isLoading: false, | ||
| isValidating: false, | ||
| }) | ||
|
|
||
| renderHook(() => usePublishedVariables()) | ||
|
|
||
| expect(mockedUseSWR).toHaveBeenCalledWith( | ||
| [ | ||
| 'https://api.figma.com/v1/files/test-key/variables/published', | ||
| 'test-token', | ||
| ], | ||
| expect.any(Function), | ||
| undefined | ||
| ) | ||
|
|
||
| spy.mockRestore() | ||
| }) | ||
| }) | ||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -445,6 +445,7 @@ describe('useVariables', () => { | |
| token: null, | ||
| fileKey: null, | ||
| fallbackFile: mockLocalVariablesResponse, | ||
| parsedFallbackFile: mockLocalVariablesResponse, | ||
| } as ReturnType<typeof useFigmaTokenContextModule.useFigmaTokenContext>) | ||
|
|
||
| mockedUseSWR.mockReturnValue({ | ||
|
|
@@ -505,4 +506,33 @@ describe('useVariables', () => { | |
|
|
||
| spy.mockRestore() | ||
| }) | ||
|
||
|
|
||
| it('should use live key when fallbackFile exists but parsedFallbackFile is invalid', () => { | ||
| const spy = vi | ||
| .spyOn(useFigmaTokenContextModule, 'useFigmaTokenContext') | ||
| .mockReturnValue({ | ||
| token: 'test-token', | ||
| fileKey: 'test-key', | ||
| fallbackFile: '{invalid-json}', | ||
| parsedFallbackFile: undefined, | ||
| providerId: 'test-provider', | ||
| } as ReturnType<typeof useFigmaTokenContextModule.useFigmaTokenContext>) | ||
|
|
||
| mockedUseSWR.mockReturnValue({ | ||
| data: undefined, | ||
| error: undefined, | ||
| isLoading: false, | ||
| isValidating: false, | ||
| }) | ||
|
|
||
| renderHook(() => useVariables()) | ||
|
|
||
| expect(mockedUseSWR).toHaveBeenCalledWith( | ||
| ['https://api.figma.com/v1/files/test-key/variables/local', 'test-token'], | ||
| expect.any(Function), | ||
| undefined | ||
| ) | ||
|
|
||
| spy.mockRestore() | ||
| }) | ||
| }) | ||


There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The validateFallbackData function is marked as @internal in its JSDoc comment, but it's being exported from the main index.ts (line 98), making it part of the public API. The @internal tag should be changed to @public to reflect its actual visibility, or if it should remain internal, it should not be exported from the main index.ts file.