Skip to content

Commit

Permalink
changed according to coderabbitai
Browse files Browse the repository at this point in the history
  • Loading branch information
gurramkarthiknetha committed Jan 11, 2025
1 parent 65f8ffb commit 30bbb99
Show file tree
Hide file tree
Showing 22 changed files with 77 additions and 62 deletions.
2 changes: 1 addition & 1 deletion src/components/Advertisements/Advertisements.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -407,7 +407,7 @@ describe('Testing Advertisement Component', () => {
});
const mediaPreview = await screen.findByTestId('mediaPreview');
expect(mediaPreview).toBeInTheDocument();
userEvent.selectOptions(
await userEvent.selectOptions(
screen.getByLabelText('Select type of Advertisement'),
'POPUP',
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -580,7 +580,7 @@ describe('Testing Advertisement Register Component', () => {
type: 'video/mp4',
});
const mediaInput = screen.getByTestId('advertisementMedia');
userEvent.upload(mediaInput, mediaFile);
await userEvent.upload(mediaInput, mediaFile);

const mediaPreview = await screen.findByTestId('mediaPreview');
expect(mediaPreview).toBeInTheDocument();
Expand Down Expand Up @@ -637,7 +637,7 @@ describe('Testing Advertisement Register Component', () => {
type: 'video/mp4',
});
const mediaInput = screen.getByTestId('advertisementMedia');
userEvent.upload(mediaInput, mediaFile);
await userEvent.upload(mediaInput, mediaFile);

const mediaPreview = await screen.findByTestId('mediaPreview');
expect(mediaPreview).toBeInTheDocument();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,8 @@ describe('Testing Custom Field Dropdown', () => {
});

await wait();

availableFieldTypes.forEach(async (_, index) => {
act(async () => {
await userEvent.click(getByTestId(`dropdown-btn-${index}`));
});
});
for (const [index] of availableFieldTypes.entries()) {
await userEvent.click(getByTestId(`dropdown-btn-${index}`));
}
});
});
Original file line number Diff line number Diff line change
Expand Up @@ -152,13 +152,13 @@ describe('Testing Organization Update', () => {
await userEvent.type(name, formData.name);
await userEvent.type(des, formData.description);
await userEvent.type(city, formData.address.city);
userEvent.selectOptions(countryCode, formData.address.countryCode);
await userEvent.selectOptions(countryCode, formData.address.countryCode);
await userEvent.type(line1, formData.address.line1);
await userEvent.type(line2, formData.address.line2);
await userEvent.type(postalCode, formData.address.postalCode);
await userEvent.type(dependentLocality, formData.address.dependentLocality);
await userEvent.type(sortingCode, formData.address.sortingCode);
userEvent.upload(displayImage, formData.displayImage);
await userEvent.upload(displayImage, formData.displayImage);
await userEvent.click(userRegistrationRequired);
await userEvent.click(isVisible);

Expand Down Expand Up @@ -238,13 +238,13 @@ describe('Testing Organization Update', () => {
await userEvent.type(name, formData.name);
await userEvent.type(des, formData.description);
await userEvent.type(city, formData.address.city);
userEvent.selectOptions(countryCode, formData.address.countryCode);
await userEvent.selectOptions(countryCode, formData.address.countryCode);
await userEvent.type(line1, formData.address.line1);
await userEvent.type(line2, formData.address.line2);
await userEvent.type(postalCode, formData.address.postalCode);
await userEvent.type(dependentLocality, formData.address.dependentLocality);
await userEvent.type(sortingCode, formData.address.sortingCode);
userEvent.upload(displayImage, formData.displayImage);
await userEvent.upload(displayImage, formData.displayImage);
await userEvent.click(userRegistrationRequired);
await userEvent.click(isVisible);

Expand Down
12 changes: 6 additions & 6 deletions src/components/RecurrenceOptions/CustomRecurrence.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -249,13 +249,13 @@ describe('Testing the creaction of recurring events with custom recurrence patte

const weekDaysOptions = screen.getAllByTestId('recurrenceWeekDay');

weekDaysOptions.forEach(async (weekDay) => {
await userEvent.click(weekDay);
});
await Promise.all(
weekDaysOptions.map((weekDay) => userEvent.click(weekDay)),
);

weekDaysOptions.forEach(async (weekDay) => {
await userEvent.click(weekDay);
});
await Promise.all(
weekDaysOptions.map((weekDay) => userEvent.click(weekDay)),
);

await userEvent.click(screen.getByTestId('customRecurrenceSubmitBtn'));
await waitFor(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/components/UserPortal/PostCard/PostCard.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,7 @@ describe('Testing PostCard Component [User Portal]', () => {
await wait();

expect(screen.getByTestId('editPostModalTitle')).toBeInTheDocument();
userEvent.clear(screen.getByTestId('postInput'));
await userEvent.clear(screen.getByTestId('postInput'));
await userEvent.type(screen.getByTestId('postInput'), 'Edited Post');
await userEvent.click(screen.getByTestId('editPostBtn'));
await wait();
Expand Down
4 changes: 2 additions & 2 deletions src/components/UsersTableItem/UserTableItem.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -1315,9 +1315,9 @@ describe('Testing User Table Item', () => {
`changeRoleInOrg${'abc'}`,
) as HTMLSelectElement;
expect(changeRoleBtn).toBeInTheDocument();
userEvent.selectOptions(changeRoleBtn, 'ADMIN');
await userEvent.selectOptions(changeRoleBtn, 'ADMIN');
await wait();
userEvent.selectOptions(changeRoleBtn, 'USER');
await userEvent.selectOptions(changeRoleBtn, 'USER');
await wait();
expect(changeRoleBtn.value).toBe(`USER?abc`);
await wait();
Expand Down
4 changes: 2 additions & 2 deletions src/components/Venues/VenueModal.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,7 @@ describe('VenueModal', () => {

const file = new File(['chad'], 'chad.png', { type: 'image/png' });
const fileInput = screen.getByTestId('venueImgUrl');
userEvent.upload(fileInput, file);
await userEvent.upload(fileInput, file);

await wait();

Expand All @@ -190,7 +190,7 @@ describe('VenueModal', () => {

const file = new File(['chad'], 'chad.png', { type: 'image/png' });
const fileInput = screen.getByTestId('venueImgUrl');
userEvent.upload(fileInput, file);
await userEvent.upload(fileInput, file);

await wait();

Expand Down
4 changes: 2 additions & 2 deletions src/screens/BlockUser/BlockUser.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -483,11 +483,11 @@ describe('Testing Block/Unblock user screen', () => {
expect(searchBar).toBeInTheDocument();
await userEvent.type(searchBar, 'Dummy{enter}');
await wait();
userEvent.clear(searchBar);
await userEvent.clear(searchBar);
await userEvent.type(searchBar, 'Dummy');
await userEvent.click(searchBtn);
await wait();
userEvent.clear(searchBar);
await userEvent.clear(searchBar);
await userEvent.type(searchBar, '');
await userEvent.click(searchBtn);
});
Expand Down
2 changes: 1 addition & 1 deletion src/screens/CommunityProfile/CommunityProfile.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ describe('Testing Community Profile Screen', () => {
await userEvent.type(youtube, profileVariables.socialUrl);
await userEvent.type(reddit, profileVariables.socialUrl);
await userEvent.type(slack, profileVariables.socialUrl);
userEvent.upload(logo, profileVariables.logo);
await userEvent.upload(logo, profileVariables.logo);
await wait();

expect(communityName).toHaveValue(profileVariables.name);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -323,7 +323,7 @@ describe('Testing VolunteerGroupModal', () => {
expect(vrInput).toHaveValue('');
});

userEvent.clear(vrInput);
await userEvent.clear(vrInput);
await userEvent.type(vrInput, '1{backspace}');

await waitFor(() => {
Expand Down
2 changes: 1 addition & 1 deletion src/screens/ManageTag/ManageTag.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,7 @@ describe('Manage Tag Page', () => {
});

const tagNameInput = screen.getByTestId('tagNameInput');
await userEvent.clear(tagNameInput);
await await userEvent.clear(tagNameInput);
await userEvent.type(tagNameInput, 'tag 1 edited');
expect(tagNameInput).toHaveValue('tag 1 edited');

Expand Down
20 changes: 10 additions & 10 deletions src/screens/MemberDetail/MemberDetail.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -164,48 +164,48 @@ describe('MemberDetail', () => {
target: { value: formData.birthDate },
});

userEvent.clear(screen.getByPlaceholderText(/First Name/i));
await userEvent.clear(screen.getByPlaceholderText(/First Name/i));
await userEvent.type(
screen.getByPlaceholderText(/First Name/i),
formData.firstName,
);

userEvent.clear(screen.getByPlaceholderText(/Last Name/i));
await userEvent.clear(screen.getByPlaceholderText(/Last Name/i));
await userEvent.type(
screen.getByPlaceholderText(/Last Name/i),
formData.lastName,
);

userEvent.clear(screen.getByPlaceholderText(/Address/i));
await userEvent.clear(screen.getByPlaceholderText(/Address/i));
await userEvent.type(
screen.getByPlaceholderText(/Address/i),
formData.address,
);

userEvent.clear(screen.getByPlaceholderText(/Country Code/i));
await userEvent.clear(screen.getByPlaceholderText(/Country Code/i));
await userEvent.type(
screen.getByPlaceholderText(/Country Code/i),
formData.countryCode,
);

userEvent.clear(screen.getByPlaceholderText(/State/i));
await userEvent.clear(screen.getByPlaceholderText(/State/i));
await userEvent.type(screen.getByPlaceholderText(/State/i), formData.state);

userEvent.clear(screen.getByPlaceholderText(/City/i));
await userEvent.clear(screen.getByPlaceholderText(/City/i));
await userEvent.type(screen.getByPlaceholderText(/City/i), formData.city);

userEvent.clear(screen.getByPlaceholderText(/Email/i));
await userEvent.clear(screen.getByPlaceholderText(/Email/i));
await userEvent.type(screen.getByPlaceholderText(/Email/i), formData.email);

userEvent.clear(screen.getByPlaceholderText(/Phone/i));
await userEvent.clear(screen.getByPlaceholderText(/Phone/i));
await userEvent.type(
screen.getByPlaceholderText(/Phone/i),
formData.phoneNumber,
);

// await userEvent.click(screen.getByPlaceholderText(/pluginCreationAllowed/i));
// userEvent.selectOptions(screen.getByTestId('applangcode'), 'Français');
// userEvent.upload(screen.getByLabelText(/Display Image:/i), formData.image);
// await userEvent.selectOptions(screen.getByTestId('applangcode'), 'Français');
// await userEvent.upload(screen.getByLabelText(/Display Image:/i), formData.image);
await wait();

await userEvent.click(screen.getByText(/Save Changes/i));
Expand Down
6 changes: 3 additions & 3 deletions src/screens/OrgList/OrgList.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ describe('Organisations Page testing as SuperAdmin', () => {
formData.address.state,
);

userEvent.selectOptions(
await userEvent.selectOptions(
screen.getByTestId('countrycode'),
formData.address.countryCode,
);
Expand Down Expand Up @@ -311,7 +311,7 @@ describe('Organisations Page testing as SuperAdmin', () => {
expect(screen.getByTestId(/visibleInSearch/i)).toBeChecked();
expect(screen.getByLabelText(/Display Image/i)).toBeTruthy();
const displayImage = screen.getByTestId('organisationImage');
userEvent.upload(displayImage, formData.image);
await userEvent.upload(displayImage, formData.image);
await userEvent.click(screen.getByTestId(/submitOrganizationForm/i));
await waitFor(() => {
expect(
Expand Down Expand Up @@ -367,7 +367,7 @@ describe('Organisations Page testing as SuperAdmin', () => {
screen.getByPlaceholderText(/Postal Code/i),
formData.address.postalCode,
);
userEvent.selectOptions(
await userEvent.selectOptions(
screen.getByTestId('countrycode'),
formData.address.countryCode,
);
Expand Down
26 changes: 19 additions & 7 deletions src/screens/OrgPost/OrgPost.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -233,10 +233,22 @@ describe('Organisation Post Page', () => {
await userEvent.type(screen.getByTestId('modalTitle'), formData.posttitle);

await userEvent.type(screen.getByTestId('modalinfo'), formData.postinfo);
userEvent.upload(screen.getByTestId('addMediaField'), formData.postImage);
userEvent.upload(screen.getByTestId('addMediaField'), formData.postVideo);
userEvent.upload(screen.getByTestId('addMediaField'), formData.postImage);
userEvent.upload(screen.getByTestId('addMediaField'), formData.postVideo);
await userEvent.upload(
screen.getByTestId('addMediaField'),
formData.postImage,
);
await userEvent.upload(
screen.getByTestId('addMediaField'),
formData.postVideo,
);
await userEvent.upload(
screen.getByTestId('addMediaField'),
formData.postImage,
);
await userEvent.upload(
screen.getByTestId('addMediaField'),
formData.postVideo,
);
await userEvent.click(screen.getByTestId('pinPost'));
expect(screen.getByTestId('pinPost')).toBeChecked();

Expand Down Expand Up @@ -449,7 +461,7 @@ describe('Organisation Post Page', () => {
type: 'image/png',
});
const imageInput = screen.getByTestId('addMediaField');
userEvent.upload(imageInput, imageFile);
await userEvent.upload(imageInput, imageFile);

// Check if the image is displayed
const imagePreview = await screen.findByAltText('Post Image Preview');
Expand Down Expand Up @@ -574,7 +586,7 @@ describe('Organisation Post Page', () => {
type: 'image/png',
});
const input = screen.getByTestId('addMediaField');
userEvent.upload(input, file);
await userEvent.upload(input, file);

await screen.findByAltText('Post Image Preview');
expect(screen.getByAltText('Post Image Preview')).toBeInTheDocument();
Expand Down Expand Up @@ -620,7 +632,7 @@ describe('Organisation Post Page', () => {
});

await act(async () => {
userEvent.upload(screen.getByTestId('addMediaField'), videoFile);
await userEvent.upload(screen.getByTestId('addMediaField'), videoFile);
});

// Check if the video is displayed
Expand Down
2 changes: 1 addition & 1 deletion src/screens/Requests/Requests.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ describe('Testing Requests screen', () => {

const search5 = 'Xe';
await userEvent.type(screen.getByTestId(/searchByName/i), search5);
userEvent.clear(screen.getByTestId(/searchByName/i));
await userEvent.clear(screen.getByTestId(/searchByName/i));
await userEvent.type(screen.getByTestId(/searchByName/i), '');
await userEvent.click(searchBtn);
await wait();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -385,7 +385,7 @@ describe('Testing Organizations Screen [User Portal]', () => {

expect(screen.queryByText('anyOrganization2')).toBeInTheDocument();

userEvent.clear(screen.getByTestId('searchInput'));
await userEvent.clear(screen.getByTestId('searchInput'));
await userEvent.click(searchBtn);
await wait();
});
Expand Down
2 changes: 1 addition & 1 deletion src/screens/UserPortal/Posts/Posts.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ describe('Testing Home Screen: User Portal', () => {
renderHomeScreen();

await wait();
userEvent.upload(
await userEvent.upload(
screen.getByTestId('postImageInput'),
new File(['image content'], 'image.png', { type: 'image/png' }),
);
Expand Down
18 changes: 12 additions & 6 deletions src/screens/UserPortal/Settings/Settings.spec.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -258,21 +258,27 @@ describe('Testing Settings Screen [User Portal]', () => {
await wait();
await userEvent.type(screen.getByTestId('inputLastName'), 'Mittal');
await wait();
userEvent.selectOptions(screen.getByTestId('inputGender'), 'Male');
await userEvent.selectOptions(screen.getByTestId('inputGender'), 'Male');
await wait();
await userEvent.type(screen.getByTestId('inputPhoneNumber'), '1234567890');
await wait();
userEvent.selectOptions(screen.getByTestId('inputGrade'), 'Grade-1');
await userEvent.selectOptions(screen.getByTestId('inputGrade'), 'Grade-1');
await wait();
userEvent.selectOptions(screen.getByTestId('inputEmpStatus'), 'Unemployed');
await userEvent.selectOptions(
screen.getByTestId('inputEmpStatus'),
'Unemployed',
);
await wait();
userEvent.selectOptions(screen.getByTestId('inputMaritalStatus'), 'Single');
await userEvent.selectOptions(
screen.getByTestId('inputMaritalStatus'),
'Single',
);
await wait();
await userEvent.type(screen.getByTestId('inputAddress'), 'random');
await wait();
await userEvent.type(screen.getByTestId('inputState'), 'random');
await wait();
userEvent.selectOptions(screen.getByTestId('inputCountry'), 'IN');
await userEvent.selectOptions(screen.getByTestId('inputCountry'), 'IN');
await wait();
expect(screen.getByTestId('resetChangesBtn')).toBeInTheDocument();
await wait();
Expand All @@ -289,7 +295,7 @@ describe('Testing Settings Screen [User Portal]', () => {
type: 'image/jpeg',
});
const files = [imageFile];
userEvent.upload(fileInp, files);
await userEvent.upload(fileInp, files);
await wait();
expect(screen.getByTestId('profile-picture')).toBeInTheDocument();
});
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ describe('Testing GroupModal', () => {
expect(vrInput).toHaveValue('');
});

userEvent.clear(vrInput);
await userEvent.clear(vrInput);
await userEvent.type(vrInput, '1{backspace}');

await waitFor(() => {
Expand Down
Loading

0 comments on commit 30bbb99

Please sign in to comment.