-
Notifications
You must be signed in to change notification settings - Fork 758
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
docs: updated verious util function docs, added tests, refactoring (#…
…1129) * docs: updated verious util function docs, added tests, refactoring * docs: json util jsdocs improvements * chore: typo quickfix * chore: added missing results to jsdoc examples * chore: removed jsdoc from non-exported helper function * chore: utils/json docs fixes and refactoring
- Loading branch information
Showing
7 changed files
with
147 additions
and
19 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { isSierra, extractContractHashes } from '../../src/utils/contract'; | ||
import { compiledHelloSierra, compiledHelloSierraCasm, compiledErc20 } from '../config/fixtures'; | ||
|
||
describe('isSierra', () => { | ||
test('should return true for a contract in Sierra format', () => { | ||
expect(isSierra(compiledHelloSierra)).toBe(true); | ||
}); | ||
|
||
test('should return false for a contract not in Sierra format', () => { | ||
expect(isSierra(compiledErc20)).toBe(false); | ||
}); | ||
}); | ||
|
||
describe('extractContractHashes', () => { | ||
test('should properly extract hashes from contract', () => { | ||
const declareContractPayload = { | ||
contract: compiledHelloSierra, | ||
casm: compiledHelloSierraCasm, | ||
}; | ||
const result = extractContractHashes(declareContractPayload); | ||
|
||
expect(result).toHaveProperty( | ||
'classHash', | ||
'0x50f3c3b9bb088969310de339fd1c1da88945f5db15bd5ea0810e4d954308734' | ||
); | ||
expect(result).toHaveProperty( | ||
'compiledClassHash', | ||
'0x31c736e739e4bd35116ed6cdcbb99c94e6f4fa8268d339da23e1ca80fe1de8d' | ||
); | ||
}); | ||
}); |
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 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