Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: types so that w3infra would have been evident #507

Merged
merged 2 commits into from
Mar 8, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion packages/upload-api/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,13 @@ export interface CarStoreBucket {
createUploadUrl: (
link: UnknownLink,
size: number
) => Promise<{ url: URL; headers: { 'x-amz-checksum-sha256': string } }>
) => Promise<{
url: URL
headers: {
'x-amz-checksum-sha256': string
'content-length': string
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what motivated adding this?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Because w3infra passes content-length as number which was not included here. This made type checker pass but test fail because it checked against string. If this type existed this would have been caught without back and forth.

} & Record<string, string>
}>
}

export interface CarStoreBucketOptions {
Expand Down
36 changes: 21 additions & 15 deletions packages/upload-api/test/store.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,28 @@ describe('store/*', () => {
const access = AccessVerifier.create({ id })

try {
await test(assert, {
id,
errorReporter: {
catch(error) {
assert.fail(error)
},
await test(
{
equal: assert.strictEqual,
deepEqual: assert.deepStrictEqual,
},
maxUploadSize: 5_000_000_000,
storeTable,
testStoreTable: storeTable,
uploadTable,
carStoreBucket,
dudewhereBucket,
access,
testSpaceRegistry: access,
})
{
id,
errorReporter: {
catch(error) {
assert.fail(error)
},
},
maxUploadSize: 5_000_000_000,
storeTable,
testStoreTable: storeTable,
uploadTable,
carStoreBucket,
dudewhereBucket,
access,
testSpaceRegistry: access,
}
)
} finally {
await carStoreBucket.deactivate()
}
Expand Down
36 changes: 21 additions & 15 deletions packages/upload-api/test/upload.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,22 +26,28 @@ describe('upload/*', () => {
const access = AccessVerifier.create({ id })

try {
await test(assert, {
id,
errorReporter: {
catch(error) {
assert.fail(error)
},
await test(
{
equal: assert.strictEqual,
deepEqual: assert.deepStrictEqual,
},
maxUploadSize: 5_000_000_000,
storeTable,
testStoreTable: storeTable,
uploadTable,
carStoreBucket,
dudewhereBucket,
access,
testSpaceRegistry: access,
})
{
id,
errorReporter: {
catch(error) {
assert.fail(error)
},
},
maxUploadSize: 5_000_000_000,
storeTable,
testStoreTable: storeTable,
uploadTable,
carStoreBucket,
dudewhereBucket,
access,
testSpaceRegistry: access,
}
)
} finally {
await carStoreBucket.deactivate()
}
Expand Down