Skip to content

Commit

Permalink
Merge pull request #7 from commons-stack/fix-web-tests
Browse files Browse the repository at this point in the history
fixed compilation errors for tests
  • Loading branch information
jorvixsky authored Sep 28, 2023
2 parents 8a72342 + 44331d5 commit b17e348
Showing 1 changed file with 14 additions and 14 deletions.
28 changes: 14 additions & 14 deletions apps/web/test/domain/model/VotingConfig.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,74 +4,74 @@ describe('VotingConfig', () => {
describe('constructor', () => {
it('should set default values if no arguments are passed', () => {
const config = new VotingConfig();
expect(config.supportRequired).toEqual(50);
expect(config.minimumAcceptanceQuorum).toEqual(15);
expect(config.voteDurationMinutes).toEqual(60 * 24 * 7);
expect(config.getSupportRequiredValue()).toEqual(50);
expect(config.getMinimumAcceptanceQuorumValue()).toEqual(15);
expect(config.getVoteDurationMinutes()).toEqual(60 * 24 * 7);
});

it('should set the values passed as arguments', () => {
const config = new VotingConfig(60, 20, 60 * 24);
expect(config.supportRequired).toEqual(60);
expect(config.minimumAcceptanceQuorum).toEqual(20);
expect(config.voteDurationMinutes).toEqual(60 * 24);
expect(config.getSupportRequiredValue()).toEqual(60);
expect(config.getMinimumAcceptanceQuorumValue()).toEqual(20);
expect(config.getVoteDurationMinutes()).toEqual(60 * 24);
});
});

describe('setSupportRequiredValue', () => {
it('should set the supportRequired value', () => {
const config = new VotingConfig();
config.setSupportRequiredValue(60);
expect(config.supportRequired).toEqual(60);
expect(config.getSupportRequiredValue()).toEqual(60);
});
});

describe('setMinimumAcceptanceQuorumValue', () => {
it('should set the minimumAcceptanceQuorum value', () => {
const config = new VotingConfig();
config.setMinimumAcceptanceQuorumValue(20);
expect(config.minimumAcceptanceQuorum).toEqual(20);
expect(config.getMinimumAcceptanceQuorumValue()).toEqual(20);
});
});

describe('setVoteDurationDays', () => {
it('should set the voteDurationMinutes value based on the number of days passed', () => {
const config = new VotingConfig();
config.setVoteDurationDays(3);
expect(config.voteDurationMinutes).toEqual(60 * 24 * 3);
expect(config.getVoteDurationMinutes()).toEqual(60 * 24 * 3);
});

it('should add the number of days passed to the existing voteDurationMinutes value', () => {
const config = new VotingConfig(50, 15, 60 * 24 * 3);
config.setVoteDurationDays(2);
expect(config.voteDurationMinutes).toEqual(60 * 24 * 2);
expect(config.getVoteDurationMinutes()).toEqual(60 * 24 * 2);
});
});

describe('setVoteDurationHours', () => {
it('should set the voteDurationMinutes value based on the number of hours passed', () => {
const config = new VotingConfig();
config.setVoteDurationHours(3);
expect(config.voteDurationMinutes).toEqual(7*24*60 + 60 * 3);
expect(config.getVoteDurationMinutes()).toEqual(7*24*60 + 60 * 3);
});

it('should add the number of hours passed to the existing voteDurationMinutes value', () => {
const config = new VotingConfig(50, 15, 60 * 24 * 3);
config.setVoteDurationHours(2);
expect(config.voteDurationMinutes).toEqual(60 * 24 * 3 + 60 * 2);
expect(config.getVoteDurationMinutes()).toEqual(60 * 24 * 3 + 60 * 2);
});
});

describe('setVoteDurationMinutes', () => {
it('should set the voteDurationMinutes value based on the number of minutes passed', () => {
const config = new VotingConfig();
config.setVoteDurationMinutes(30);
expect(config.voteDurationMinutes).toEqual(7*24*60 + 30);
expect(config.getVoteDurationMinutes()).toEqual(7*24*60 + 30);
});

it('should add the number of minutes passed to the existing voteDurationMinutes value', () => {
const config = new VotingConfig(50, 15, 60 * 24 * 3);
config.setVoteDurationMinutes(30);
expect(config.voteDurationMinutes).toEqual(60 * 24 * 3 + 30);
expect(config.getVoteDurationMinutes()).toEqual(60 * 24 * 3 + 30);
});
});

Expand Down

0 comments on commit b17e348

Please sign in to comment.