Skip to content

Commit

Permalink
Added tests for countrycode in the OrgUpdate file
Browse files Browse the repository at this point in the history
  • Loading branch information
Anubhav-2003 committed Jan 27, 2024
1 parent 2bbacbb commit 9f7c8f1
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/components/OrgUpdate/OrgUpdate.test.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,7 @@ describe('Testing Organization Update', () => {
const name = screen.getByPlaceholderText(/Enter Organization Name/i);
const des = screen.getByPlaceholderText(/Description/i);
const city = screen.getByPlaceholderText(/City/i);
const countryCode = screen.getByTestId('countrycode');
const line1 = screen.getByPlaceholderText(/Line 1/i);
const line2 = screen.getByPlaceholderText(/Line 2/i);
const dependentLocality =
Expand All @@ -84,6 +85,7 @@ describe('Testing Organization Update', () => {
expect(name).toHaveValue('Palisadoes');
expect(des).toHaveValue('Equitable Access to STEM Education Jobs');
expect(city).toHaveValue('Kingston');
expect(countryCode).toHaveValue('JM');
expect(dependentLocality).toHaveValue('Sample Dependent Locality');
expect(line1).toHaveValue('123 Jamaica Street');
expect(line2).toHaveValue('Apartment 456');
Expand Down Expand Up @@ -111,6 +113,7 @@ describe('Testing Organization Update', () => {
const des = screen.getByPlaceholderText(/Description/i);

const city = screen.getByPlaceholderText(/City/i);
const countryCode = screen.getByTestId('countrycode');
const line1 = screen.getByPlaceholderText(/Line 1/i);
const line2 = screen.getByPlaceholderText(/Line 2/i);
const dependentLocality =
Expand All @@ -137,6 +140,7 @@ describe('Testing Organization Update', () => {
userEvent.type(name, formData.name);
userEvent.type(des, formData.description);
userEvent.type(city, formData.address.city);
userEvent.selectOptions(countryCode, formData.address.countryCode);
userEvent.type(line1, formData.address.line1);
userEvent.type(line2, formData.address.line2);
userEvent.type(postalCode, formData.address.postalCode);
Expand All @@ -153,6 +157,7 @@ describe('Testing Organization Update', () => {
expect(name).toHaveValue(formData.name);
expect(des).toHaveValue(formData.description);
expect(city).toHaveValue(formData.address.city);
expect(countryCode).toHaveValue(formData.address.countryCode);
expect(dependentLocality).toHaveValue(formData.address.dependentLocality);
expect(line1).toHaveValue(formData.address.line1);
expect(line2).toHaveValue(formData.address.line2);
Expand Down Expand Up @@ -194,6 +199,7 @@ describe('Testing Organization Update', () => {
const name = screen.getByPlaceholderText(/Enter Organization Name/i);
const des = screen.getByPlaceholderText(/Description/i);
const city = screen.getByPlaceholderText(/City/i);
const countryCode = screen.getByTestId('countrycode');
const line1 = screen.getByPlaceholderText(/Line 1/i);
const line2 = screen.getByPlaceholderText(/Line 2/i);
const dependentLocality =
Expand All @@ -220,6 +226,7 @@ describe('Testing Organization Update', () => {
userEvent.type(name, formData.name);
userEvent.type(des, formData.description);
userEvent.type(city, formData.address.city);
userEvent.selectOptions(countryCode, formData.address.countryCode);
userEvent.type(line1, formData.address.line1);
userEvent.type(line2, formData.address.line2);
userEvent.type(postalCode, formData.address.postalCode);
Expand Down
1 change: 1 addition & 0 deletions src/components/OrgUpdate/OrgUpdate.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ function orgUpdate(props: InterfaceOrgUpdateProps): JSX.Element {
required
as="select"
value={formState.address.countryCode}
data-testid="countrycode"
onChange={(e) => {
const countryCode = e.target.value;
handleInputChange('countryCode', countryCode);
Expand Down

0 comments on commit 9f7c8f1

Please sign in to comment.