Skip to content

Commit

Permalink
Rename variables
Browse files Browse the repository at this point in the history
rb -> randomBeacon mock variables: CAPS -> camelCase
  • Loading branch information
kpyszkowski committed Oct 12, 2023
1 parent b68d3b5 commit 112e081
Showing 1 changed file with 17 additions and 14 deletions.
31 changes: 17 additions & 14 deletions src/utils/__tests__/getStakingAppLabel.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,42 +6,45 @@ import {
import { StakingAppName } from "../../store/staking-applications"
import { getThresholdLib } from "../getThresholdLib"

const MOCK_ADDRESSES: Record<StakingAppName, string> = {
const mockAddresses: Record<StakingAppName, string> = {
tbtc: getThresholdLib().multiAppStaking.ecdsa.address,
randomBeacon: getThresholdLib().multiAppStaking.randomBeacon.address,
}
const MOCK_LABELS: Record<StakingAppName, string> = {
const mockLabels: Record<StakingAppName, string> = {
tbtc: "tBTC",
randomBeacon: "Random Beacon",
}
const MOCK_APP_NAMES: StakingAppName[] = ["tbtc", "randomBeacon"]
const mockAppNames: StakingAppName[] = ["tbtc", "randomBeacon"]

describe("Staking app label utils tests", () => {
const [tbtcName, rbName] = MOCK_APP_NAMES
const tbtcAddress = MOCK_ADDRESSES[tbtcName]
const rbAddress = MOCK_ADDRESSES[rbName]
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 resultRbLabel = getStakingAppLabelFromAppAddress(rbAddress)
const resultRandomBeaconLabel =
getStakingAppLabelFromAppAddress(randomBeaconAddress)

expect(resultTbtcLabel).toBe(MOCK_LABELS[tbtcName])
expect(resultRbLabel).toBe(MOCK_LABELS[rbName])
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 resultRbLabel = getStakingAppLabelFromAppName(rbName)
const resultRandomBeaconLabel =
getStakingAppLabelFromAppName(randomBeaconName)

expect(resultTbtcLabel).toBe(MOCK_LABELS[tbtcName])
expect(resultRbLabel).toBe(MOCK_LABELS[rbName])
expect(resultTbtcLabel).toBe(mockLabels[tbtcName])
expect(resultRandomBeaconLabel).toBe(mockLabels[randomBeaconName])
})

it("returns correct app name if address is given", () => {
const resultTbtcName = getStakingAppNameFromAppAddress(tbtcAddress)
const resultRbName = getStakingAppNameFromAppAddress(rbAddress)
const resultRandomBeaconName =
getStakingAppNameFromAppAddress(randomBeaconAddress)

expect(resultTbtcName).toBe(tbtcName)
expect(resultRbName).toBe(rbName)
expect(resultRandomBeaconName).toBe(randomBeaconName)
})
})

0 comments on commit 112e081

Please sign in to comment.