Skip to content

Commit

Permalink
fix comments
Browse files Browse the repository at this point in the history
  • Loading branch information
josemarinas committed Dec 12, 2023
1 parent f2b4e80 commit 6c831e4
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 7 deletions.
4 changes: 2 additions & 2 deletions modules/client/src/internal/client/methods.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ import {
} from "../types";
import {
classifyProposalActions,
containsDaoUpdateAction,
startsWithDaoUpdateAction,
toAssetBalance,
toDaoActions,
toDaoDetails,
Expand Down Expand Up @@ -1199,7 +1199,7 @@ export class ClientMethods extends ClientCore implements IClientMethods {
const classifiedActions = classifyProposalActions(daoActions);

// remove upgradeToAndCall action
if (containsDaoUpdateAction(classifiedActions)) {
if (startsWithDaoUpdateAction(classifiedActions)) {
daoActions = daoActions.slice(1);
}

Expand Down
4 changes: 2 additions & 2 deletions modules/client/src/internal/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1408,7 +1408,7 @@ export function containsPluginUpdateActionBlock(
* @param {ProposalActionTypes[]} actions
* @return {*} {boolean}
*/
export function containsDaoUpdateAction(
export function startsWithDaoUpdateAction(
actions: ProposalActionTypes[],
): boolean {
// UpgradeTo or UpgradeToAndCall should be the first action
Expand All @@ -1426,7 +1426,7 @@ export function validateUpdateDaoProposalActions(
const actionErrorCauses: DaoUpdateProposalInvalidityCause[] = [];
const proposalSettingsErrorCauses: ProposalSettingsErrorCause[] = [];
// check if the actions are valid
if (!containsDaoUpdateAction(classifiedActions)) {
if (!startsWithDaoUpdateAction(classifiedActions)) {
// If actions are not valid, add the cause to the causes array
// and return
return {
Expand Down
6 changes: 3 additions & 3 deletions modules/client/test/unit/client/utils.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ import {
TOKEN_VOTING_BUILD_METADATA,
} from "../../integration/constants";
import {
containsDaoUpdateAction,
startsWithDaoUpdateAction,
containsPluginUpdateActionBlock,
containsPluginUpdateActionBlockWithRootPermission,
validateApplyUpdateFunction,
Expand Down Expand Up @@ -1323,7 +1323,7 @@ describe("Test client utils", () => {
expect(result.proposalSettingsErrorCauses).toMatchObject([]);
});
});
describe("containsDaoUpdateAction", () => {
describe("startsWithDaoUpdateAction", () => {
it("should return the expected output given a specific input", () => {
const cases = [
{ input: [ProposalActionTypes.UPGRADE_TO], expected: true },
Expand Down Expand Up @@ -1389,7 +1389,7 @@ describe("Test client utils", () => {
},
];
for (const { input, expected } of cases) {
const result = containsDaoUpdateAction(input);
const result = startsWithDaoUpdateAction(input);
expect(result).toEqual(expected);
}
});
Expand Down

0 comments on commit 6c831e4

Please sign in to comment.