-
Notifications
You must be signed in to change notification settings - Fork 196
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
feat(common): new utils, truncate table ID parts #1173
Conversation
🦋 Changeset detectedLatest commit: f061394 The changes in this PR will be included in the next version bump. This PR includes changesets to release 26 packages
Not sure what this means? Click here to learn what changesets are. Click here if you're a maintainer who wants to add another changeset to this PR |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
two nits, aside from that lgtm
packages/common/src/TableId.test.ts
Outdated
expect(tableId.toHex()).toMatchInlineSnapshot( | ||
'"0x41566572794c6f6e674e616d657370616e616d65000000000000000000000000"' | ||
); | ||
expect(TableId.fromHex(tableId.toHex()).namespace).toMatchInlineSnapshot('"AVeryLongNamespa"'); | ||
}); | ||
|
||
it("throws when converting names >16 bytes", () => { | ||
const tableId = new TableId("namespace", "AnUnnecessarilyLongName"); | ||
expect(() => tableId.toHex()).toThrow("Size cannot exceed 16 bytes. Given size: 23 bytes."); | ||
expect(tableId.toHex()).toMatchInlineSnapshot( | ||
'"0x6e616d65737061636500000000000000416e556e6e65636573736172696c794c"' | ||
); | ||
expect(TableId.fromHex(tableId.toHex()).name).toMatchInlineSnapshot('"AnUnnecessarilyL"'); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
we should update the titles of both of these tests to reflect the new behavior
Co-authored-by: alvarius <[email protected]>
Pulled out of #1113