File tree Expand file tree Collapse file tree 2 files changed +14
-6
lines changed
packages/messaging/src/internals Expand file tree Collapse file tree 2 files changed +14
-6
lines changed Original file line number Diff line number Diff line change
1
+ ---
2
+ ' @firebase/messaging ' : patch
3
+ ---
4
+
5
+ Revised token update logic to keep existing token
Original file line number Diff line number Diff line change @@ -133,24 +133,27 @@ describe('Token Manager', () => {
133
133
tokenDetails . createTime = Date . now ( ) - 8 * 24 * 60 * 60 * 1000 ; // 8 days ago, triggering an update
134
134
await dbSet ( messaging . firebaseDependencies , tokenDetails ) ;
135
135
requestUpdateTokenStub . rejects ( new Error ( 'Temporary server error' ) ) ;
136
-
136
+
137
137
// Act
138
- await expect ( getTokenInternal ( messaging ) ) . to . be . rejectedWith ( 'Temporary server error' ) ;
139
-
138
+ await expect ( getTokenInternal ( messaging ) ) . to . be . rejectedWith (
139
+ 'Temporary server error'
140
+ ) ;
141
+
140
142
// Assert
141
143
expect ( requestUpdateTokenStub ) . to . have . been . called ;
142
144
expect ( requestDeleteTokenStub ) . not . to . have . been . called ; // Verify delete was not called
143
-
145
+
144
146
// Reasoning documentation
145
147
// This test ensures that the token is not deleted upon an update failure,
146
148
// recognizing that such failures may be temporary server-side issues.
147
149
// By not deleting the token, we allow the system to retry the update in the future,
148
150
// avoiding unnecessary token churn and preserving continuity for the user.
149
-
151
+
150
152
const tokenFromDb = await dbGet ( messaging . firebaseDependencies ) ;
151
153
expect ( tokenFromDb ) . to . not . be . null ; // Ensure the token still exists
152
154
} ) ;
153
-
155
+ } ) ;
156
+
154
157
describe ( 'deleteToken' , ( ) => {
155
158
it ( 'returns if there is no token in the db' , async ( ) => {
156
159
await deleteTokenInternal ( messaging ) ;
You can’t perform that action at this time.
0 commit comments