normalize ota update ids
This commit is contained in:
@@ -185,11 +185,11 @@ describe('useOTAUpdateRecovery', () => {
|
|||||||
)
|
)
|
||||||
})
|
})
|
||||||
|
|
||||||
it('silently clears the marker when the attempted OTA launched', () => {
|
it('recognizes a launched OTA when the update ID casing differs', () => {
|
||||||
jest.mocked(device.get).mockReturnValue({
|
jest.mocked(device.get).mockReturnValue({
|
||||||
attemptedAt: Date.now(),
|
attemptedAt: Date.now(),
|
||||||
channel: 'pull-request-123',
|
channel: 'pull-request-123',
|
||||||
updateId: currentUpdate.updateId,
|
updateId: currentUpdate.updateId.toUpperCase(),
|
||||||
})
|
})
|
||||||
|
|
||||||
renderHook(() => useOTAUpdateRecovery())
|
renderHook(() => useOTAUpdateRecovery())
|
||||||
|
|||||||
@@ -262,7 +262,12 @@ export function useOTAUpdateRecovery() {
|
|||||||
if (!pendingUpdate || !currentlyRunning) return
|
if (!pendingUpdate || !currentlyRunning) return
|
||||||
|
|
||||||
device.remove(['pendingOTAUpdate'])
|
device.remove(['pendingOTAUpdate'])
|
||||||
if (pendingUpdate.updateId === currentlyRunning.updateId) return
|
if (
|
||||||
|
pendingUpdate.updateId.toLowerCase() ===
|
||||||
|
currentlyRunning.updateId?.toLowerCase()
|
||||||
|
) {
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// A fallback relaunch is immediate. A stale marker can be left by a
|
// A fallback relaunch is immediate. A stale marker can be left by a
|
||||||
// successful runtime-compatible bundle that predates this hook.
|
// successful runtime-compatible bundle that predates this hook.
|
||||||
|
|||||||
Reference in New Issue
Block a user