-
Notifications
You must be signed in to change notification settings - Fork 13
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
Remove reference to eosjs-ecc and add tests for new logic #32
Merged
jlamarr22
merged 1 commit into
EOSIO:develop
from
jlamarr22:remove-eosjs-ecc-references
Dec 11, 2019
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
import { Signature } from 'eosjs/dist/eosjs-jssig' | ||
import { convertSignatures } from './LedgerUtils' | ||
|
||
const mockedConvertedSignatureValue = 'mockedConvertedSignatureValue' | ||
|
||
describe('JsSignatureProvider', () => { | ||
it('should not convert signature given string with length < 130 characters', async () => { | ||
const signature = 'someSignature' | ||
const result = convertSignatures([signature], mockConvertSignature) | ||
|
||
expect(result[0]).toBe(signature) | ||
}) | ||
|
||
it('should not convert signature given string with length > 130 characters', async () => { | ||
const signature = '4cf0909aa10f10341cd7ca013630492d09b65e50c80974e962d94bbc95df635e90afb2e4dd22eb254cb451ca26a6aeb0b88e9b031a2233b2a16d56252dba83f9632-more-than-130-characters' | ||
const result = convertSignatures([signature], mockConvertSignature) | ||
|
||
expect(result[0]).toBe(signature) | ||
}) | ||
|
||
it('should convert signature given string with length === 130 characters', () => { | ||
const signature = 'SIG_K1_HKkqi3zray76i63ZQwAHWMjoLk3wTa1ajZWPcUnrhgmSWQYEHDJsxkny6VDTWEmVdfktxpGoTA81qe6QuCrDmazeQndmxhktxpGoTA81qe6QuCrDmazeQndmxhD' | ||
const result = convertSignatures([signature], mockConvertSignature) | ||
|
||
expect(result[0]).toBe(mockedConvertedSignatureValue) | ||
}) | ||
|
||
it('should convert signature given string with length === 130 characters, but not another signature with length < 130 characters', () => { | ||
const signature1 = 'SIG_K1_HKkqi3zray76i63ZQwAHWMjoLk3wTa1ajZWPcUnrhgmSWQYEHDJsxkny6VDTWEmVdfktxpGoTA81qe6QuCrDmazeQndmxhktxpGoTA81qe6QuCrDmazeQndmxhD' | ||
const signature2 = 'someSignature' | ||
const result = convertSignatures([signature1, signature2], mockConvertSignature) | ||
|
||
expect(result[0]).toBe(mockedConvertedSignatureValue) | ||
expect(result[1]).toBe(signature2) | ||
}) | ||
|
||
it('should convert signature given string with length === 130 characters, but not another signature with length > 130 characters', () => { | ||
const signature1 = 'SIG_K1_HKkqi3zray76i63ZQwAHWMjoLk3wTa1ajZWPcUnrhgmSWQYEHDJsxkny6VDTWEmVdfktxpGoTA81qe6QuCrDmazeQndmxhktxpGoTA81qe6QuCrDmazeQndmxhD' | ||
const signature2 = '4cf0909aa10f10341cd7ca013630492d09b65e50c80974e962d94bbc95df635e90afb2e4dd22eb254cb451ca26a6aeb0b88e9b031a2233b2a16d56252dba83f9632-more-than-130-characters' | ||
const result = convertSignatures([signature1, signature2], mockConvertSignature) | ||
|
||
expect(result[0]).toBe(mockedConvertedSignatureValue) | ||
expect(result[1]).toBe(signature2) | ||
}) | ||
|
||
it('should convert multiple signatures given string with length === 130 characters', () => { | ||
const signature1 = 'SIG_K1_HKkqi3zray76i63ZQwAHWMjoLk3wTa1ajZWPcUnrhgmSWQYEHDJsxkny6VDTWEmVdfktxpGoTA81qe6QuCrDmazeQndmxhktxpGoTA81qe6QuCrDmazeQndmxhD' | ||
const signature2 = 'SIG_K1_HKkqi3zray76i63ZQwAHWMjoLk3wTa1ajZWPcUnrhgmSWQYEHDJsxkny6VDTWEmVdfktxpGoTA81qe6QuCrDmazeQndmxhktxpGoTA81qe6QuCrDmazeQndmxhD' | ||
const result = convertSignatures([signature1, signature2], mockConvertSignature) | ||
|
||
expect(result[0]).toBe(mockedConvertedSignatureValue) | ||
expect(result[1]).toBe(mockedConvertedSignatureValue) | ||
}) | ||
}) | ||
|
||
function mockConvertSignature(signature: string) { | ||
return mockedConvertedSignatureValue | ||
} |
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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
These need to be updated due to this issue that's been open for a long time: LedgerHQ/ledgerjs#332, JoinColony/purser#184
This has a fix with an open PR: LedgerHQ/ledgerjs#241