Skip to content

Commit

Permalink
Merge pull request #2339 from IntersectMBO/tests/support-space-on-dRe…
Browse files Browse the repository at this point in the history
…p-name

tests/support space on dRep name
  • Loading branch information
kneerose authored Nov 6, 2024
2 parents bec09ed + 2631b12 commit b47c775
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
12 changes: 8 additions & 4 deletions tests/govtool-frontend/playwright/lib/_mock/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,8 @@ export const invalid = {
},

name: () => {
const choice = faker.number.int({ min: 1, max: 3 });
const choice = faker.number.int({ min: 1, max: 2 });
if (choice === 1) {
// space invalid
return faker.lorem.word() + " " + faker.lorem.word();
} else if (choice === 2) {
// maximum 80 words invalid
return faker.lorem.paragraphs().replace(/\s+/g, "");
}
Expand Down Expand Up @@ -97,6 +94,13 @@ export const invalid = {
};

export const valid = {
name: () => {
const choice = faker.number.int({ min: 1, max: 2 });
if (choice === 1) {
return faker.internet.displayName();
}
return faker.lorem.word() + " " + faker.lorem.word();
},
username: () => {
let timeStamp = Date.now();
let username = `${faker.internet.userName().toLowerCase()}_${timeStamp}`;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ test.describe("Validation of dRep Registration Form", () => {

for (let i = 0; i < 100; i++) {
await dRepRegistrationPage.validateForm({
name: faker.internet.displayName(),
name: mockValid.name(),
objectives: faker.lorem.paragraph(2),
motivations: faker.lorem.paragraph(2),
qualifications: faker.lorem.paragraph(2),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ test.describe("Validation of edit dRep Form", () => {

for (let i = 0; i < 100; i++) {
await editDRepPage.validateForm({
name: faker.internet.displayName(),
name: mockValid.name(),
objectives: faker.lorem.paragraph(2),
motivations: faker.lorem.paragraph(2),
qualifications: faker.lorem.paragraph(2),
Expand Down

0 comments on commit b47c775

Please sign in to comment.