Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit a2535c7

Browse files
committedOct 18, 2023
chore: add test
1 parent 9403217 commit a2535c7

File tree

1 file changed

+20
-0
lines changed

1 file changed

+20
-0
lines changed
 

‎src/main.test.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -783,6 +783,26 @@ describe('setJSON', () => {
783783

784784
expect(mockStore.fulfilled).toBeTruthy()
785785
})
786+
787+
test('Throws when the `metadata` parameter is above the size limit', async () => {
788+
const metadata = {
789+
name: 'Netlify'.repeat(1000),
790+
}
791+
const mockStore = new MockFetch()
792+
793+
globalThis.fetch = mockStore.fetch
794+
795+
const blobs = getStore({
796+
edgeURL,
797+
name: 'production',
798+
token: edgeToken,
799+
siteID,
800+
})
801+
802+
expect(async () => await blobs.setJSON(key, { value }, { metadata })).rejects.toThrowError(
803+
'Metadata object exceeds the maximum size',
804+
)
805+
})
786806
})
787807
})
788808

0 commit comments

Comments
 (0)
Please sign in to comment.