Skip to content

Commit

Permalink
Improve topic descriptioins and unit tests
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonz-dfinity committed Jul 18, 2024
1 parent 24053f3 commit 2388924
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 35 deletions.
2 changes: 1 addition & 1 deletion frontend/src/lib/i18n/en.governance.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@
"ApiBoundaryNodeManagement": "Proposals related to the management of API boundary nodes.",
"SubnetRental": "Proposals related to renting a subnet — for example a subnet rental request.",
"ProtocolCanisterManagement": "Proposals related to managing canisters that are considered as part of the IC protocol.",
"ServiceNervousSystemManagement": "All proposals related to managing the service nervous system (SNS)."
"ServiceNervousSystemManagement": "All proposals related to managing the canisters related to service nervous system (SNS)."
},
"rewards": {
"Unknown": "Unknown",
Expand Down
2 changes: 1 addition & 1 deletion frontend/src/lib/i18n/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -369,7 +369,7 @@
"topic_17_title": "Protocol Canister Management",
"topic_17_subtitle": "Proposals related to managing canisters that are considered as part of the IC protocol.",
"topic_18_title": "Service Nervous System Management",
"topic_18_subtitle": "Proposals related to managing the service nervous system (SNS).",
"topic_18_subtitle": "Proposals related to managing the canisters related to service nervous system (SNS).",
"current_followees": "Currently Following",
"add": "Add Followee"
},
Expand Down
85 changes: 52 additions & 33 deletions frontend/src/tests/lib/utils/neuron.utils.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,7 @@ import { DEFAULT_TRANSACTION_FEE_E8S } from "$lib/constants/icp.constants";
import {
MAX_NEURONS_MERGED,
MIN_NEURON_STAKE,
TOPICS_TO_FOLLOW_NNS,
TOPICS_WITH_FOLLOWING_DISABLED,
} from "$lib/constants/neurons.constants";
import { DEPRECATED_TOPICS } from "$lib/constants/proposals.constants";
import type { IcpAccountsStoreData } from "$lib/derived/icp-accounts.derived";
import { neuronsStore } from "$lib/stores/neurons.store";
import { nowInSeconds } from "$lib/utils/date.utils";
Expand Down Expand Up @@ -2168,39 +2165,61 @@ describe("neuron-utils", () => {
};

it("should not return deprecated or disabled topics", () => {
expect(topicsToFollow(neuronWithoutManageNeuron)).toEqual(
TOPICS_TO_FOLLOW_NNS.filter(
(topic) =>
topic !== Topic.ManageNeuron &&
!DEPRECATED_TOPICS.includes(topic) &&
!TOPICS_WITH_FOLLOWING_DISABLED.includes(topic)
)
);
expect(topicsToFollow(neuronWithoutFollowees)).toEqual(
TOPICS_TO_FOLLOW_NNS.filter(
(topic) =>
topic !== Topic.ManageNeuron &&
!DEPRECATED_TOPICS.includes(topic) &&
!TOPICS_WITH_FOLLOWING_DISABLED.includes(topic)
)
);
expect(topicsToFollow(neuronWithManageNeuron)).toEqual(
TOPICS_TO_FOLLOW_NNS.filter(
(topic) =>
!DEPRECATED_TOPICS.includes(topic) &&
!TOPICS_WITH_FOLLOWING_DISABLED.includes(topic)
)
);
expect(topicsToFollow(neuronWithoutManageNeuron)).toEqual([
Topic.Unspecified,
Topic.Governance,
Topic.SnsAndCommunityFund,
Topic.NetworkEconomics,
Topic.NodeAdmin,
Topic.ParticipantManagement,
Topic.SubnetManagement,
Topic.NetworkCanisterManagement,
Topic.Kyc,
Topic.NodeProviderRewards,
Topic.SubnetReplicaVersionManagement,
Topic.ReplicaVersionManagement,
Topic.ApiBoundaryNodeManagement,
Topic.SubnetRental,
Topic.ExchangeRate,
]);
expect(topicsToFollow(neuronWithoutFollowees)).toEqual([
Topic.Unspecified,
Topic.Governance,
Topic.SnsAndCommunityFund,
Topic.NetworkEconomics,
Topic.NodeAdmin,
Topic.ParticipantManagement,
Topic.SubnetManagement,
Topic.NetworkCanisterManagement,
Topic.Kyc,
Topic.NodeProviderRewards,
Topic.SubnetReplicaVersionManagement,
Topic.ReplicaVersionManagement,
Topic.ApiBoundaryNodeManagement,
Topic.SubnetRental,
Topic.ExchangeRate,
]);
});

it("should return topics with ManageNeuron if neuron follows some neuron on the ManageNeuron topic", () => {
expect(topicsToFollow(neuronWithManageNeuron)).toEqual(
TOPICS_TO_FOLLOW_NNS.filter(
(topic) =>
!DEPRECATED_TOPICS.includes(topic) &&
!TOPICS_WITH_FOLLOWING_DISABLED.includes(topic)
)
);
expect(topicsToFollow(neuronWithManageNeuron)).toEqual([
Topic.Unspecified,
Topic.Governance,
Topic.SnsAndCommunityFund,
Topic.ManageNeuron,
Topic.NetworkEconomics,
Topic.NodeAdmin,
Topic.ParticipantManagement,
Topic.SubnetManagement,
Topic.NetworkCanisterManagement,
Topic.Kyc,
Topic.NodeProviderRewards,
Topic.SubnetReplicaVersionManagement,
Topic.ReplicaVersionManagement,
Topic.ApiBoundaryNodeManagement,
Topic.SubnetRental,
Topic.ExchangeRate,
]);
});
});

Expand Down

0 comments on commit 2388924

Please sign in to comment.