-
Notifications
You must be signed in to change notification settings - Fork 50
fix: google revocation handling #1484
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
Open
tyler-dane
wants to merge
21
commits into
main
Choose a base branch
from
fix/1478-import-bug
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
21 commits
Select commit
Hold shift + click to select a range
da23a45
refactor(issue-templates): simplify feature request and bug report te…
tyler-dane c595d6b
test(socket): enhance SocketProvider tests with async act calls
tyler-dane c23bdf7
test(socket): add race condition handling test for useGcalSync
tyler-dane c8c6415
delete(svg): remove unused circle.svg file
tyler-dane 958fb6e
fix(socket): address PR review comments for useGcalSync
tyler-dane f0894e7
refactor(sync): rename awaitingImportResults to isImportPending
tyler-dane 776cc9e
refactor(socket): simplify reconnect logic and update test case
tyler-dane 30cd79d
refactor(tests): update useGcalSync tests to remove fake timers
tyler-dane 7270fc7
test(socket): add integration tests for Google Calendar re-authentica…
tyler-dane b1a6c40
refactor(sync): rename setAwaitingImportResults to setIsImportPending
tyler-dane a197200
feat(errors): enhance Google token error handling and add correspondi…
tyler-dane 9fad698
feat(user): implement pruneGoogleData method and corresponding tests
tyler-dane 5893bb0
feat(sync): implement Google revoked access handling and notifications
tyler-dane caa4be8
feat(api): implement Google revoked access handling in CompassApi
tyler-dane ae71ea2
Merge branch 'main' into fix/1478-import-bug
tyler-dane 61e4803
chore: fix conflicts in useGcalSync
tyler-dane 37c2e7a
refactor: revert try/catch in event.controller
tyler-dane ca7c910
test(compass): enhance Google revoked access handling tests
tyler-dane 546a81b
test(socket): enhance useGcalSync tests with timer management
tyler-dane 43f53ca
refactor(errors): improve Google error handling type safety
tyler-dane 4437b75
feat(sync): implement deleteWatchesByUser and enhance Google error ha…
tyler-dane File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
59 changes: 59 additions & 0 deletions
59
packages/backend/src/__tests__/mocks.gcal/errors/error.google.factory.ts
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,59 @@ | ||
| import { GaxiosError } from "gaxios"; | ||
|
|
||
| export const createGoogleError = ( | ||
| overrides: { | ||
| code?: string | number; | ||
| responseStatus?: number; | ||
| message?: string; | ||
| } = {}, | ||
| ) => { | ||
| const url = new URL("https://www.googleapis.com/calendar/v3"); | ||
| const headers = new Headers(); | ||
|
|
||
| const error = new GaxiosError( | ||
| overrides.message ?? "test google error", | ||
| { | ||
| headers, | ||
| url, | ||
| }, | ||
| overrides.responseStatus | ||
| ? { | ||
| config: { | ||
| headers, | ||
| url, | ||
| }, | ||
| status: overrides.responseStatus, | ||
| statusText: "ERROR", | ||
| headers, | ||
| data: {}, | ||
| ok: false, | ||
| redirected: false, | ||
| type: "error" as ResponseType, | ||
| url: url.toString(), | ||
| body: null, | ||
| bodyUsed: false, | ||
| clone: () => { | ||
| throw new Error("Not implemented"); | ||
| }, | ||
| arrayBuffer: async () => { | ||
| throw new Error("Not implemented"); | ||
| }, | ||
| blob: async () => { | ||
| throw new Error("Not implemented"); | ||
| }, | ||
| formData: async () => { | ||
| throw new Error("Not implemented"); | ||
| }, | ||
| json: async () => ({}), | ||
| text: async () => "", | ||
| bytes: async () => { | ||
| throw new Error("Not implemented"); | ||
| }, | ||
| } | ||
| : undefined, | ||
| ); | ||
|
|
||
| error.code = overrides.code; | ||
|
|
||
| return error; | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
This test spies on webSocketServer.handleGoogleRevoked but doesn't mock its implementation or assert it was called. Because webSocketServer is a singleton with internal connection state, calling the real method can make the test order-dependent/flaky. Mock the implementation (e.g., mockImplementation(() => undefined)) and add an expectation that it was invoked with the userId (and restore the spy after the test).