fix expected endpoint response
Signed-off-by: Meredith Lancaster <malancas@github.com>
This commit is contained in:
@@ -48,13 +48,13 @@ describe('createStorageRecord', () => {
|
||||
registry_url: 'https://my-registry.org'
|
||||
})
|
||||
})
|
||||
.reply(201, {storage_records: [{id: '123'}, {id: '456'}]})
|
||||
.reply(200, {storage_records: [{id: 123}, {id: 456}]})
|
||||
})
|
||||
|
||||
it('persists the storage record', async () => {
|
||||
await expect(createStorageRecord(options)).resolves.toEqual([
|
||||
'123',
|
||||
'456'
|
||||
123,
|
||||
456
|
||||
])
|
||||
})
|
||||
})
|
||||
@@ -114,7 +114,7 @@ describe('createStorageRecord', () => {
|
||||
registry_url: options.packageRegistryOptions.registryUrl
|
||||
})
|
||||
})
|
||||
.reply(201, {storage_records: [{id: '123'}, {id: '456'}]})
|
||||
.reply(200, {storage_records: [{id: 123}, {id: 456}]})
|
||||
.times(1)
|
||||
})
|
||||
|
||||
@@ -124,7 +124,7 @@ describe('createStorageRecord', () => {
|
||||
...options,
|
||||
writeOptions: {}
|
||||
})
|
||||
).resolves.toEqual(['123', '456'])
|
||||
).resolves.toEqual([123, 456])
|
||||
})
|
||||
})
|
||||
})
|
||||
|
||||
@@ -51,7 +51,7 @@ export type StorageRecordOptions = {
|
||||
*/
|
||||
export async function createStorageRecord(
|
||||
options: StorageRecordOptions
|
||||
): Promise<string[]> {
|
||||
): Promise<number[]> {
|
||||
const retries = options.writeOptions.retry ?? DEFAULT_RETRY_COUNT
|
||||
const octokit = github.getOctokit(options.token, {retry: {retries}}, retry)
|
||||
|
||||
@@ -67,7 +67,7 @@ export async function createStorageRecord(
|
||||
? JSON.parse(response.data)
|
||||
: response.data
|
||||
|
||||
return data?.storage_records.map((r: {id: number}) => String(r.id))
|
||||
return data?.storage_records.map((r: {id: number}) => r.id)
|
||||
} catch (err) {
|
||||
const message = err instanceof Error ? err.message : err
|
||||
throw new Error(`Failed to persist storage record: ${message}`)
|
||||
|
||||
Reference in New Issue
Block a user