Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ChaituVR committed Jan 4, 2025
1 parent f828941 commit 2b4c67f
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/writer/proposal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export async function verify(body): Promise<any> {
if (
space.voting?.privacy !== 'any' &&
msg.payload.privacy &&
!(space.voting.privacy === 'shutter' && msg.payload.privacy === 'shutter')
!(space.voting?.privacy === 'shutter' && msg.payload.privacy === 'shutter')
) {
return Promise.reject('not allowed to set privacy');
}
Expand Down
1 change: 1 addition & 0 deletions test/schema.sql
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ CREATE TABLE proposals (
scores_state VARCHAR(24) NOT NULL,
scores_total DECIMAL(64,30) NOT NULL,
scores_updated INT(11) NOT NULL,
vp_value_by_strategy JSON DEFAULT NULL,
votes INT(12) NOT NULL,
flagged INT NOT NULL DEFAULT 0,
PRIMARY KEY (id),
Expand Down
8 changes: 4 additions & 4 deletions test/unit/writer/proposal.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -425,11 +425,11 @@ describe('writer/proposal', () => {
expect(mockGetSpace).toHaveBeenCalledTimes(1);
});

it('rejects a proposal with no privacy', async () => {
it('accepts a proposal with empty string in privacy', async () => {
expect.assertions(2);
await expect(writer.verify(updateInputPayload(input, { privacy: '' }))).rejects.toMatch(
'not allowed to set privacy'
);
await expect(
writer.verify(updateInputPayload(input, { privacy: '' }))
).resolves.toBeUndefined();
expect(mockGetSpace).toHaveBeenCalledTimes(1);
});
});
Expand Down

0 comments on commit 2b4c67f

Please sign in to comment.