Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Move VAOS unit tests: Batch 2 #32910

Merged
merged 1 commit into from
Nov 6, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -8,12 +8,12 @@ import {
createTestStore,
renderWithStoreAndRouter,
setVaccineFacility,
} from '../../mocks/setup';
} from '../../tests/mocks/setup';

import ClinicChoicePage from '../../../covid-19-vaccine/components/ClinicChoicePage';
import { TYPE_OF_CARE_ID } from '../../../covid-19-vaccine/utils';
import { mockEligibilityFetches } from '../../mocks/fetch';
import { createMockClinic } from '../../mocks/data';
import ClinicChoicePage from './ClinicChoicePage';
import { TYPE_OF_CARE_ID } from '../utils';
import { mockEligibilityFetches } from '../../tests/mocks/fetch';
import { createMockClinic } from '../../tests/mocks/data';

const initialState = {
featureToggles: {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import { waitFor } from '@testing-library/dom';
import { expect } from 'chai';
import moment from 'moment';

Check warning on line 3 in src/applications/vaos/covid-19-vaccine/components/ConfirmationPage.unit.spec.js

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/vaos/covid-19-vaccine/components/ConfirmationPage.unit.spec.js:3:1:Use date-fns or Native Date methods instead of moment.js
import React from 'react';
import ConfirmationPage from '../../../covid-19-vaccine/components/ConfirmationPage';
import { createTestStore, renderWithStoreAndRouter } from '../../mocks/setup';
import { FETCH_STATUS } from '../../../utils/constants';
import { getICSTokens } from '../../../utils/calendar';
import ConfirmationPage from './ConfirmationPage';
import {
createTestStore,
renderWithStoreAndRouter,
} from '../../tests/mocks/setup';
import { FETCH_STATUS } from '../../utils/constants';
import { getICSTokens } from '../../utils/calendar';

const initialState = {
featureToggles: {
Expand All @@ -15,7 +18,7 @@

describe('VAOS vaccine flow: ConfirmationPage', () => {
it('should show confirmation details', async () => {
const start = moment();

Check warning on line 21 in src/applications/vaos/covid-19-vaccine/components/ConfirmationPage.unit.spec.js

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/vaos/covid-19-vaccine/components/ConfirmationPage.unit.spec.js:21:19:Consider using Native new Date().
const store = createTestStore({
covid19Vaccine: {
submitStatus: FETCH_STATUS.succeeded,
Expand Down Expand Up @@ -103,7 +106,7 @@
});

it('should verify VA in person calendar ics file format', async () => {
const start = moment().tz('America/Denver');

Check warning on line 109 in src/applications/vaos/covid-19-vaccine/components/ConfirmationPage.unit.spec.js

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/vaos/covid-19-vaccine/components/ConfirmationPage.unit.spec.js:109:19:Consider using Native new Date().
const store = createTestStore({
covid19Vaccine: {
submitStatus: FETCH_STATUS.succeeded,
Expand Down Expand Up @@ -189,17 +192,17 @@
'2360 East Pershing Boulevard\\, Cheyenne\\, WY 82001-5356',
);
expect(tokens.get('DTSTAMP')).to.equal(
`${moment(start)

Check warning on line 195 in src/applications/vaos/covid-19-vaccine/components/ConfirmationPage.unit.spec.js

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/vaos/covid-19-vaccine/components/ConfirmationPage.unit.spec.js:195:10:Consider using Native new Date().
.utc()
.format('YYYYMMDDTHHmmss[Z]')}`,
);
expect(tokens.get('DTSTART')).to.equal(
`${moment(start)

Check warning on line 200 in src/applications/vaos/covid-19-vaccine/components/ConfirmationPage.unit.spec.js

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/vaos/covid-19-vaccine/components/ConfirmationPage.unit.spec.js:200:10:Consider using Native new Date().
.utc()
.format('YYYYMMDDTHHmmss[Z]')}`,
);
expect(tokens.get('DTEND')).to.equal(
`${moment(start)

Check warning on line 205 in src/applications/vaos/covid-19-vaccine/components/ConfirmationPage.unit.spec.js

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/vaos/covid-19-vaccine/components/ConfirmationPage.unit.spec.js:205:10:Consider using Native new Date().
.utc()
.add(30, 'minutes')
.format('YYYYMMDDTHHmmss[Z]')}`,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,14 @@
import { waitFor } from '@testing-library/dom';
import { expect } from 'chai';
import moment from 'moment';

Check warning on line 3 in src/applications/vaos/covid-19-vaccine/components/ConfirmationPageV2.unit.spec.js

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/vaos/covid-19-vaccine/components/ConfirmationPageV2.unit.spec.js:3:1:Use date-fns or Native Date methods instead of moment.js
import React from 'react';
import ConfirmationPageV2 from '../../../covid-19-vaccine/components/ConfirmationPageV2';
import { createTestStore, renderWithStoreAndRouter } from '../../mocks/setup';
import { FETCH_STATUS } from '../../../utils/constants';
import { getICSTokens } from '../../../utils/calendar';
import ConfirmationPageV2 from './ConfirmationPageV2';
import {
createTestStore,
renderWithStoreAndRouter,
} from '../../tests/mocks/setup';
import { FETCH_STATUS } from '../../utils/constants';
import { getICSTokens } from '../../utils/calendar';

const initialState = {
featureToggles: {
Expand All @@ -13,7 +16,7 @@
},
};

const start = moment();

Check warning on line 19 in src/applications/vaos/covid-19-vaccine/components/ConfirmationPageV2.unit.spec.js

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/vaos/covid-19-vaccine/components/ConfirmationPageV2.unit.spec.js:19:15:Consider using Native new Date().
const store = createTestStore({
covid19Vaccine: {
submitStatus: FETCH_STATUS.succeeded,
Expand Down Expand Up @@ -165,13 +168,13 @@
'2360 East Pershing Boulevard\\, Cheyenne\\, WY 82001-5356',
);
expect(tokens.get('DTSTAMP')).to.equal(
`${moment(start)

Check warning on line 171 in src/applications/vaos/covid-19-vaccine/components/ConfirmationPageV2.unit.spec.js

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/vaos/covid-19-vaccine/components/ConfirmationPageV2.unit.spec.js:171:10:Consider using Native new Date().
.tz('America/Denver', true) // Only change the timezone and not the time
.utc()
.format('YYYYMMDDTHHmmss[Z]')}`,
);
expect(tokens.get('DTSTART')).to.equal(
`${moment(start)

Check warning on line 177 in src/applications/vaos/covid-19-vaccine/components/ConfirmationPageV2.unit.spec.js

View workflow job for this annotation

GitHub Actions / Linting (Files Changed)

src/applications/vaos/covid-19-vaccine/components/ConfirmationPageV2.unit.spec.js:177:10:Consider using Native new Date().
.tz('America/Denver', true) // Only change the timezone and not the time
.utc()
.format('YYYYMMDDTHHmmss[Z]')}`,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,15 @@ import React from 'react';
import { expect } from 'chai';

import { mockFetch } from '@department-of-veterans-affairs/platform-testing/helpers';
import ContactFacilitiesPage from '../../../covid-19-vaccine/components/ContactFacilitiesPage';
import { createTestStore, renderWithStoreAndRouter } from '../../mocks/setup';
import { createMockFacility } from '../../mocks/data';
import { mockFacilitiesFetch } from '../../mocks/fetch';
import { mockSchedulingConfigurations } from '../../mocks/helpers';
import { getSchedulingConfigurationMock } from '../../mocks/mock';
import ContactFacilitiesPage from './ContactFacilitiesPage';
import {
createTestStore,
renderWithStoreAndRouter,
} from '../../tests/mocks/setup';
import { createMockFacility } from '../../tests/mocks/data';
import { mockFacilitiesFetch } from '../../tests/mocks/fetch';
import { mockSchedulingConfigurations } from '../../tests/mocks/helpers';
import { getSchedulingConfigurationMock } from '../../tests/mocks/mock';

describe('VAOS vaccine flow: ContactFacilitiesPage', () => {
const initialState = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ import { expect } from 'chai';
import userEvent from '@testing-library/user-event';

import { cleanup } from '@testing-library/react';
import ContactInfoPage from '../../../covid-19-vaccine/components/ContactInfoPage';
import { createTestStore, renderWithStoreAndRouter } from '../../mocks/setup';
import ContactInfoPage from './ContactInfoPage';
import {
createTestStore,
renderWithStoreAndRouter,
} from '../../tests/mocks/setup';

describe('VAOS Page: ContactInfoPage', () => {
it('should submit with valid data', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,11 @@ import { expect } from 'chai';
import { waitFor } from '@testing-library/dom';
import userEvent from '@testing-library/user-event';

import PlanAheadPage from '../../../covid-19-vaccine/components/PlanAheadPage';
import { createTestStore, renderWithStoreAndRouter } from '../../mocks/setup';
import PlanAheadPage from './PlanAheadPage';
import {
createTestStore,
renderWithStoreAndRouter,
} from '../../tests/mocks/setup';

const store = createTestStore();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,12 @@ import React from 'react';
import { expect } from 'chai';
import { fireEvent, waitFor } from '@testing-library/dom';
import { cleanup } from '@testing-library/react';
import { createTestStore, renderWithStoreAndRouter } from '../../mocks/setup';
import {
createTestStore,
renderWithStoreAndRouter,
} from '../../tests/mocks/setup';

import ReceivedDoseScreenerPage from '../../../covid-19-vaccine/components/ReceivedDoseScreenerPage';
import ReceivedDoseScreenerPage from './ReceivedDoseScreenerPage';

const initialState = {
featureToggles: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,14 @@ import {
} from '@department-of-veterans-affairs/platform-testing/helpers';
import environment from '@department-of-veterans-affairs/platform-utilities/environment';

import { createTestStore, renderWithStoreAndRouter } from '../../mocks/setup';
import {
createTestStore,
renderWithStoreAndRouter,
} from '../../tests/mocks/setup';

import ReviewPage from '../../../covid-19-vaccine/components/ReviewPage';
import { onCalendarChange } from '../../../covid-19-vaccine/redux/actions';
import { mockAppointmentSubmit } from '../../mocks/helpers';
import ReviewPage from './ReviewPage';
import { onCalendarChange } from '../redux/actions';
import { mockAppointmentSubmit } from '../../tests/mocks/helpers';

describe('VAOS vaccine flow: ReviewPage', () => {
let store;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,12 @@ import { expect } from 'chai';
import userEvent from '@testing-library/user-event';

import { waitFor } from '@testing-library/dom';
import { createTestStore, renderWithStoreAndRouter } from '../../mocks/setup';
import {
createTestStore,
renderWithStoreAndRouter,
} from '../../tests/mocks/setup';

import SecondDosePage from '../../../covid-19-vaccine/components/SecondDosePage';
import SecondDosePage from './SecondDosePage';

const initialState = {
featureToggles: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ import {
renderWithStoreAndRouter,
setVaccineFacility,
setVaccineClinic,
} from '../../mocks/setup';
} from '../../tests/mocks/setup';

import SelectDate1Page from '../../../covid-19-vaccine/components/SelectDate1Page';
import { TYPE_OF_CARE_ID } from '../../../covid-19-vaccine/utils';
import { mockEligibilityFetches } from '../../mocks/fetch';
import { createMockClinic } from '../../mocks/data';
import { mockAppointmentSlotFetch } from '../../mocks/helpers';
import SelectDate1Page from './SelectDate1Page';
import { TYPE_OF_CARE_ID } from '../utils';
import { mockEligibilityFetches } from '../../tests/mocks/fetch';
import { createMockClinic } from '../../tests/mocks/data';
import { mockAppointmentSlotFetch } from '../../tests/mocks/helpers';

const initialState = {
featureToggles: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,22 +9,25 @@ import {
import environment from '@department-of-veterans-affairs/platform-utilities/environment';
import { fireEvent, waitFor, within } from '@testing-library/dom';
import { cleanup } from '@testing-library/react';
import VAFacilityPage from '../../../../covid-19-vaccine/components/VAFacilityPage';
import VAFacilityPage from '.';
import {
createTestStore,
renderWithStoreAndRouter,
} from '../../../mocks/setup';
import { TYPE_OF_CARE_ID } from '../../../../covid-19-vaccine/utils';
import { createMockClinic, createMockFacility } from '../../../mocks/data';
} from '../../../tests/mocks/setup';
import { TYPE_OF_CARE_ID } from '../../utils';
import {
createMockClinic,
createMockFacility,
} from '../../../tests/mocks/data';
import {
mockEligibilityFetches,
mockFacilitiesFetch,
} from '../../../mocks/fetch';
} from '../../../tests/mocks/fetch';
import {
mockSchedulingConfigurations,
mockGetCurrentPosition,
} from '../../../mocks/helpers';
import { getSchedulingConfigurationMock } from '../../../mocks/mock';
} from '../../../tests/mocks/helpers';
import { getSchedulingConfigurationMock } from '../../../tests/mocks/mock';

const facilityIds = ['983', '983GB', '983GC', '983HK', '983QA', '984'];

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,15 @@ import {
setFetchJSONResponse,
} from '@department-of-veterans-affairs/platform-testing/helpers';
import environment from '@department-of-veterans-affairs/platform-utilities/environment';
import { createTestStore, renderWithStoreAndRouter } from '../../mocks/setup';
import { NewBookingSection } from '../../../covid-19-vaccine';
import { mockFacilitiesFetch } from '../../mocks/fetch';
import { createMockFacility } from '../../mocks/data';
import { mockSchedulingConfigurations } from '../../mocks/helpers';
import { getSchedulingConfigurationMock } from '../../mocks/mock';
import {
createTestStore,
renderWithStoreAndRouter,
} from '../tests/mocks/setup';
import { NewBookingSection } from '.';
import { mockFacilitiesFetch } from '../tests/mocks/fetch';
import { createMockFacility } from '../tests/mocks/data';
import { mockSchedulingConfigurations } from '../tests/mocks/helpers';
import { getSchedulingConfigurationMock } from '../tests/mocks/mock';

const initialState = {
featureToggles: {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,11 @@ import React from 'react';
import { expect } from 'chai';
// import sinon from 'sinon';
import userEvent from '@testing-library/user-event';
import { createTestStore, renderWithStoreAndRouter } from '../mocks/setup';
import ChooseDateAndTime from '../../referral-appointments/ChooseDateAndTime';
import {
createTestStore,
renderWithStoreAndRouter,
} from '../tests/mocks/setup';
import ChooseDateAndTime from './ChooseDateAndTime';

// Tests skipped for now since there are issues with displaying TZ and redux/data in flux.
describe('VAOS referral-appointments', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
import React from 'react';
import { expect } from 'chai';
import sinon from 'sinon';
import ScheduleReferral from '../../../referral-appointments/ScheduleReferral';
import { createTestStore, renderWithStoreAndRouter } from '../../mocks/setup';
import { referral } from '../../../referral-appointments/temp-data/referral';
import ScheduleReferral from './ScheduleReferral';
import {
createTestStore,
renderWithStoreAndRouter,
} from '../tests/mocks/setup';
import { referral } from './temp-data/referral';

describe('scheduleReferral component', () => {
it('should display the subtitle correctly given different numbers of appointments', async () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,19 @@ import {
getLongTermAppointmentHistoryV2,
isUpcomingAppointmentOrRequest,
isValidPastAppointment,
} from '../../../services/appointment';
} from '.';
import {
APPOINTMENT_STATUS,
APPOINTMENT_TYPES,
VIDEO_TYPES,
} from '../../../utils/constants';
import moment from '../../../lib/moment-tz';
import { createMockAppointment } from '../../mocks/data';
import { getDateRanges, mockVAOSAppointmentsFetch } from '../../mocks/helpers';
import { generateAppointmentUrl } from '../../../utils/appointment';
} from '../../utils/constants';
import moment from '../../lib/moment-tz';
import { createMockAppointment } from '../../tests/mocks/data';
import {
getDateRanges,
mockVAOSAppointmentsFetch,
} from '../../tests/mocks/helpers';
import { generateAppointmentUrl } from '../../utils/appointment';

function setRequestedPeriod(date, amOrPm) {
const isAM = amOrPm.toUpperCase() === 'AM';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ import {
setFetchJSONFailure,
} from 'platform/testing/unit/helpers';

import { getAvailableHealthcareServices } from '../../../services/healthcare-service';
import mockClinics from '../../../services/mocks/v2/clinics.json';
import { getAvailableHealthcareServices } from '.';
import mockClinics from '../mocks/v2/clinics.json';

describe('VAOS Services: Healthcare ', () => {
beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ import {
getLocation,
getLocations,
getLocationsByTypeOfCareAndSiteIds,
} from '../../../services/location';
import facilityDetails from '../../../services/mocks/v2/facilities.json';
import ccProviders from '../../../services/mocks/v2/cc_providers.json';
import { VHA_FHIR_ID } from '../../../utils/constants';
import { mockFacilitiesFetch } from '../../mocks/fetch';
import { createMockFacility } from '../../mocks/data';
import { mockSchedulingConfigurations } from '../../mocks/helpers';
import { getSchedulingConfigurationMock } from '../../mocks/mock';
} from '.';
import facilityDetails from '../mocks/v2/facilities.json';
import ccProviders from '../mocks/v2/cc_providers.json';
import { VHA_FHIR_ID } from '../../utils/constants';
import { mockFacilitiesFetch } from '../../tests/mocks/fetch';
import { createMockFacility } from '../../tests/mocks/data';
import { mockSchedulingConfigurations } from '../../tests/mocks/helpers';
import { getSchedulingConfigurationMock } from '../../tests/mocks/mock';

describe('VAOS Services: Location ', () => {
describe('getLocations', () => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { expect } from 'chai';
import generateMockSlots from '../../../services/mocks/var/slots';
import generateMockSlots from './var/slots';

describe('calendar mock data', () => {
it('should generate 300 mock slots', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
} from 'platform/testing/unit/helpers';

import moment from 'moment';
import { getSlots } from '../../../services/slot';
import { getSlots } from '.';

describe('VAOS Services: Slot ', () => {
describe('getSlots', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { expect } from 'chai';

import { mockFetch, setFetchJSONResponse } from 'platform/testing/unit/helpers';

import { mapToFHIRErrors, fhirSearch } from '../../services/utils';
import mockData from '../../services/mocks/fhir/mock_organizations.json';
import { mapToFHIRErrors, fhirSearch } from './utils';
import mockData from './mocks/fhir/mock_organizations.json';

describe('VAOS Utils: FHIR ', () => {
describe('mapToFHIRError', () => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ import {
setFetchJSONResponse,
} from '@department-of-veterans-affairs/platform-testing/helpers';
import environment from '@department-of-veterans-affairs/platform-utilities/environment';
import { getCommunityCareFacilities } from '../../../services/vaos/index';
import { calculateBoundingBox } from '../../../utils/address';
import { getCommunityCareFacilities } from './index';
import { calculateBoundingBox } from '../../utils/address';

describe('VAOS Services: CC facilities API', () => {
beforeEach(() => {});
Expand Down
39 changes: 0 additions & 39 deletions src/applications/vaos/tests/useFormPageTester.js

This file was deleted.

Loading
Loading