-
Notifications
You must be signed in to change notification settings - Fork 7
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* add byteaToBase64 * handle non-resident keys, enforce new keys are residents
- Loading branch information
Showing
18 changed files
with
147 additions
and
304 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
import { describe, expect, it } from '@jest/globals' | ||
|
||
import { byteaToBase64 } from './byteaToBase64' | ||
|
||
describe('test byteaToBase64', () => { | ||
it('test byteaToBase64', () => { | ||
expect(byteaToBase64('\\x')).toBe('') // empty string | ||
expect(byteaToBase64('\\x1234')).toBe('EjQ=') // single character | ||
expect(byteaToBase64('\\x12345678')).toBe('EjRWeA==') // two characters | ||
expect(byteaToBase64('\\x1234567890')).toBe('EjRWeJA=') // three characters | ||
}) | ||
it('fails on invalid input', () => { | ||
// @ts-expect-error Testing with null or empty string | ||
expect(() => byteaToBase64('invalid-string')).toThrow('Hex string must start with \\x') | ||
// @ts-expect-error Testing with null or empty string | ||
expect(() => byteaToBase64('0x12345678901234567890123456789012345678901234')).toThrow( | ||
'Hex string must start with \\x' | ||
) | ||
}) | ||
}) |
Oops, something went wrong.