-
Notifications
You must be signed in to change notification settings - Fork 578
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* feat: labels on proposals * remove unwanted log * add more condtions for labels like max length and pattern * fix update proposal * v0.12.20
- Loading branch information
Showing
7 changed files
with
70 additions
and
2 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 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,32 @@ | ||
import { describe, expect, test } from 'vitest'; | ||
const { createHash } = require('crypto'); | ||
import * as types from '../../../src/sign/types'; | ||
import hashedTypes from '../../../src/sign/hashedTypes.json'; | ||
import kebabCase from 'lodash/kebabCase'; | ||
|
||
function sha256(str) { | ||
return createHash('sha256').update(str).digest('hex'); | ||
} | ||
describe('sign types', () => { | ||
Object.keys(types).forEach((key) => { | ||
test(`hashed type should contain with type ${key}`, () => { | ||
const hash = sha256(JSON.stringify(types[key])); | ||
expect(hash).toBeTruthy(); | ||
const derivedKey = kebabCase( | ||
key | ||
.replace('2Types', '') | ||
.replace('Types', '') | ||
.replace('Type', '') | ||
.replace('space', 'settings') | ||
.replace('cancel', 'delete') | ||
); | ||
try { | ||
expect(hashedTypes[hash]).toBe(derivedKey); | ||
} catch (error) { | ||
throw new Error( | ||
`Hash ${hash} does not match the derived key ${derivedKey}` | ||
); | ||
} | ||
}); | ||
}); | ||
}); |
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