fix(supabase): refuse a last_modified_at a Date cannot read
The timestamp shape check lets an offset such as +99:99 through, which Date.parse reads as NaN and the date formatter would throw on. The key now also requires a readable date, so the case folds into unavailable. Test added beside the existing refusal test; no assertion changed.
This commit is contained in:
1 parent
72ec758278
commit
374e300895
2 files changed
+11
-1
No files matched your search
@@ -209,6 +209,12 @@ describe('sheet admin wrappers: answers', () => {
|
||||
expect(await kindOf(listOfficialSheetsAdmin(answer([{ ...summary, last_modified_at: 'nope' }])))).toBe('unavailable')
|
||||
})
|
||||
|
||||
it('refuses a last_modified_at the timestamp shape accepts but a Date cannot read', async () => {
|
||||
const answer = (data: unknown) => stubClient({ rpc: { data } }).client
|
||||
const unreadable = { ...summary, last_modified_at: '2026-11-09T11:06:00+99:99' }
|
||||
expect(await kindOf(listOfficialSheetsAdmin(answer([unreadable])))).toBe('unavailable')
|
||||
})
|
||||
|
||||
it('folds the server refusals into their kinds', async () => {
|
||||
const refused = (message: string, code = '42501') =>
|
||||
stubClient({ rpc: { error: { code, message }, status: 403 } }).client
|
||||
|
||||
Reference in new issue
Block a user