-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into feature/tbtc-explorer-card-font-size
- Loading branch information
Showing
11 changed files
with
95 additions
and
34 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
20 changes: 10 additions & 10 deletions
20
src/hooks/staking-applications/useSubscribeToAuthorizationIncreasedEvent.ts
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,56 @@ | ||
import { | ||
getStakingAppLabelFromAppAddress, | ||
getStakingAppLabelFromAppName, | ||
getStakingAppNameFromAppAddress, | ||
} from "../getStakingAppLabel" | ||
import { StakingAppName } from "../../store/staking-applications" | ||
import { getThresholdLib } from "../getThresholdLib" | ||
|
||
const mockAddresses: Record<StakingAppName, string> = { | ||
tbtc: getThresholdLib().multiAppStaking.ecdsa.address, | ||
randomBeacon: getThresholdLib().multiAppStaking.randomBeacon.address, | ||
} | ||
const mockLabels: Record<StakingAppName, string> = { | ||
tbtc: "tBTC", | ||
randomBeacon: "Random Beacon", | ||
} | ||
const mockAppNames: StakingAppName[] = ["tbtc", "randomBeacon"] | ||
|
||
describe("Staking app label utils tests", () => { | ||
const [tbtcName, randomBeaconName] = mockAppNames | ||
const tbtcAddress = mockAddresses[tbtcName] | ||
const randomBeaconAddress = mockAddresses[randomBeaconName] | ||
|
||
it("returns correct app label if app address is given", () => { | ||
const resultTbtcLabel = getStakingAppLabelFromAppAddress(tbtcAddress) | ||
const resultRandomBeaconLabel = | ||
getStakingAppLabelFromAppAddress(randomBeaconAddress) | ||
|
||
expect(resultTbtcLabel).toBe(mockLabels[tbtcName]) | ||
expect(resultRandomBeaconLabel).toBe(mockLabels[randomBeaconName]) | ||
}) | ||
|
||
it("returns correct app label if app name is given", () => { | ||
const resultTbtcLabel = getStakingAppLabelFromAppName(tbtcName) | ||
const resultRandomBeaconLabel = | ||
getStakingAppLabelFromAppName(randomBeaconName) | ||
|
||
expect(resultTbtcLabel).toBe(mockLabels[tbtcName]) | ||
expect(resultRandomBeaconLabel).toBe(mockLabels[randomBeaconName]) | ||
}) | ||
|
||
it("returns correct app name if address is given", () => { | ||
const resultTbtcName = getStakingAppNameFromAppAddress(tbtcAddress) | ||
const resultRandomBeaconName = | ||
getStakingAppNameFromAppAddress(randomBeaconAddress) | ||
|
||
expect(resultTbtcName).toBe(tbtcName) | ||
expect(resultRandomBeaconName).toBe(randomBeaconName) | ||
}) | ||
|
||
it("returns fallback value if address is unexpected", () => { | ||
const resultName = getStakingAppLabelFromAppAddress("0xun3xp3c73d400r3s5") | ||
|
||
expect(resultName).toBe("App") | ||
}) | ||
}) |
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