Skip to content
Open
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 @@ -5,15 +5,70 @@
// Created by InspiringApps on 12/1/2025.
//

import { expect } from 'chai';
import chaiMatchPattern from 'chai-match-pattern';
import chai from 'chai';
import { mountShallow } from '@tests/helpers/setup';
import LicenseeList from '@components/Licensee/LicenseeList/LicenseeList.vue';
import { Compact, CompactType } from '@models/Compact/Compact.model';
import { AppModes } from '@/app.config';
import store from '@store/index';

chai.use(chaiMatchPattern);

const { expect } = chai;

describe('LicenseeList component', async () => {
afterEach(async () => {
await store.dispatch('setAppMode', AppModes.JCC);
await store.dispatch('user/setCurrentCompact', null);
await store.dispatch('license/resetStoreSearch');
});

it('should mount the component', async () => {
const wrapper = await mountShallow(LicenseeList);

expect(wrapper.exists()).to.equal(true);
expect(wrapper.findComponent(LicenseeList).exists()).to.equal(true);
});
it('should successfully prepare search params including license scope', async () => {
const wrapper = await mountShallow(LicenseeList);
const component = wrapper.vm;

await component.$store.dispatch('setAppMode', AppModes.SOCIAL_WORK);
await component.$store.dispatch('user/setCurrentCompact', new Compact({ type: CompactType.SOCIAL_WORK }));
await component.$store.dispatch('license/setStoreSearch', {
homeState: 'co',
licenseScope: 'multi-state',
});

const requestConfig = component.prepareSearchBody();

expect(requestConfig).to.matchPattern({
compact: CompactType.SOCIAL_WORK,
homeState: 'co',
licenseScope: 'multi-state',
'...': '',
});
});
it('should successfully display license scope in the search tag', async () => {
const wrapper = await mountShallow(LicenseeList);
const component = wrapper.vm;

await component.$store.dispatch('setAppMode', AppModes.SOCIAL_WORK);
await component.$store.dispatch('license/setStoreSearch', {
firstName: 'Test',
lastName: 'User',
homeState: 'co',
licenseScope: 'multi-state',
});

expect(component.searchDisplayLicenseScope).to.equal(
`${component.$t('licensing.licenseScope')}: Multi state`
);
expect(component.searchDisplayAll).to.equal([
'Test User',
component.searchDisplayHomeState,
component.searchDisplayLicenseScope,
].join(', '));
});
});
20 changes: 20 additions & 0 deletions webroot/src/components/Licensee/LicenseeList/LicenseeList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,22 @@ class LicenseeList extends Vue {
return (homeState) ? `${this.$t('licensing.homeState')}: ${new State({ abbrev: homeState }).name()}` : '';
}

get searchDisplayLicenseScope(): string {
const { licenseScope } = this.searchParams;
let displayScope = '';

if (licenseScope) {
const scopeOptions = this.$tm('licensing.licenseScopes') || [];
const selectedOption = scopeOptions.find((scopeOption) => scopeOption.key === licenseScope);

if (selectedOption?.name) {
displayScope = `${this.$t('licensing.licenseScope')}: ${selectedOption.name}`;
}
}

return displayScope;
}

get searchDisplayPrivilegeState(): string {
const { privilegeState } = this.searchParams;

Expand Down Expand Up @@ -207,6 +223,7 @@ class LicenseeList extends Vue {
this.searchDisplayFullName,
this.searchDisplayDob,
this.searchDisplayHomeState,
this.searchDisplayLicenseScope,
this.searchDisplayPrivilegeState,
this.searchDisplayPrivilegePurchaseDates,
this.searchDisplayMilitaryStatus,
Expand Down Expand Up @@ -384,6 +401,9 @@ class LicenseeList extends Vue {
if (searchParams?.homeState) {
requestConfig.homeState = searchParams.homeState.toLowerCase();
}
if (searchParams?.licenseScope) {
requestConfig.licenseScope = searchParams.licenseScope;
}
if (searchParams?.privilegeState) {
requestConfig.privilegeState = searchParams.privilegeState.toLowerCase();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,15 +5,101 @@
// Created by InspiringApps on 12/1/2025.
//

import { expect } from 'chai';
import chaiMatchPattern from 'chai-match-pattern';
import chai from 'chai';
import { mountShallow } from '@tests/helpers/setup';
import LicenseeSearch from '@components/Licensee/LicenseeSearch/LicenseeSearch.vue';
import { Compact, CompactType } from '@models/Compact/Compact.model';
import { AppModes } from '@/app.config';
import store from '@store/index';

chai.use(chaiMatchPattern);

const { expect } = chai;

describe('LicenseeSearch component', async () => {
afterEach(async () => {
await store.dispatch('setAppMode', AppModes.JCC);
await store.dispatch('user/setCurrentCompact', null);
});

it('should mount the component', async () => {
const wrapper = await mountShallow(LicenseeSearch);

expect(wrapper.exists()).to.equal(true);
expect(wrapper.findComponent(LicenseeSearch).exists()).to.equal(true);
});
it('should successfully emit searchParams for social work staff search', async () => {
await store.dispatch('setAppMode', AppModes.SOCIAL_WORK);

let emittedSearchParams;
const wrapper = await mountShallow(LicenseeSearch, {
props: {
onSearchParams: (searchParams) => {
emittedSearchParams = searchParams;
},
},
});
const { formData } = wrapper.vm;

formData.homeState.value = 'co';
formData.licenseScope.value = 'multi-state';
await wrapper.vm.handleSubmit();

expect(emittedSearchParams).to.matchPattern({
homeState: 'co',
licenseScope: 'multi-state',
'...': '',
});
});
it('should successfully omit licenseScope from searchParams for social work public search', async () => {
await store.dispatch('setAppMode', AppModes.SOCIAL_WORK);
await store.dispatch('user/setCurrentCompact', new Compact({ type: CompactType.SOCIAL_WORK }));

let emittedSearchParams;
const wrapper = await mountShallow(LicenseeSearch, {
props: {
isPublicSearch: true,
onSearchParams: (searchParams) => {
emittedSearchParams = searchParams;
},
},
});
const { formData } = wrapper.vm;

formData.compact.value = CompactType.SOCIAL_WORK;
formData.homeState.value = 'co';
formData.licenseScope.value = 'multi-state';
await wrapper.vm.handleSubmit();

expect(emittedSearchParams).to.matchPattern({
compact: CompactType.SOCIAL_WORK,
homeState: 'co',
licenseScope: undefined,
'...': '',
});
});
it('should successfully omit licenseScope from searchParams for cosmetology staff search', async () => {
await store.dispatch('setAppMode', AppModes.COSMETOLOGY);

let emittedSearchParams;
const wrapper = await mountShallow(LicenseeSearch, {
props: {
onSearchParams: (searchParams) => {
emittedSearchParams = searchParams;
},
},
});
const { formData } = wrapper.vm;

formData.homeState.value = 'co';
formData.licenseScope.value = 'multi-state';
await wrapper.vm.handleSubmit();

expect(emittedSearchParams).to.matchPattern({
homeState: 'co',
licenseScope: undefined,
'...': '',
});
});
});
31 changes: 31 additions & 0 deletions webroot/src/components/Licensee/LicenseeSearch/LicenseeSearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ export interface LicenseSearch {
firstName?: string;
lastName?: string;
homeState?: string;
licenseScope?: string;
dob?: string;
privilegeState?: string;
privilegePurchaseStartDate?: string;
Expand Down Expand Up @@ -177,6 +178,20 @@ class LicenseeSearch extends mixins(MixinForm) {
return options;
}

get licenseScopeOptions(): Array<{ value: string, name: string | ComputedRef }> {
const options = this.$tm('licensing.licenseScopes').map((option) => ({
value: option.key,
name: option.name,
}));

options.unshift({
value: '',
name: computed(() => this.$t('common.selectOption')),
});

return options;
}

get investigationStatusOptions(): Array<{ value: string, name: string | ComputedRef }> {
const options = this.$tm('licensing.investigationStatusOptions').map((option) => ({
value: option.key,
Expand Down Expand Up @@ -243,6 +258,13 @@ class LicenseeSearch extends mixins(MixinForm) {
value: this.searchParams.homeState || '',
isDisabled: computed(() => this.enableCompactSelect && !this.compactType),
}),
licenseScope: new FormInput({
id: 'license-scope',
name: 'license-scope',
label: computed(() => this.$t('licensing.licenseScope')),
valueOptions: this.licenseScopeOptions,
value: this.searchParams.licenseScope || '',
}),
licenseNumber: new FormInput({
id: 'license-number',
name: 'license-number',
Expand Down Expand Up @@ -384,6 +406,10 @@ class LicenseeSearch extends mixins(MixinForm) {
allowedSearchProps.push('dob');
}

if (this.$isAppModeSocialWork && !this.isPublicSearch) {
allowedSearchProps.push('licenseScope');
}

allowedSearchProps.forEach((searchProp) => { searchProps[searchProp] = this.formValues[searchProp]; });
this.$emit('searchParams', searchProps);

Expand All @@ -403,6 +429,7 @@ class LicenseeSearch extends mixins(MixinForm) {
this.formData.encumberStartDate.value = '';
this.formData.encumberEndDate.value = '';
this.formData.npi.value = '';
this.formData.licenseScope.value = '';
this.formData.licenseNumber.value = '';
this.formData.dob.value = '';
this.isFormLoading = false;
Expand Down Expand Up @@ -431,6 +458,10 @@ class LicenseeSearch extends mixins(MixinForm) {
this.formData.dob.value = moment('1970-01-01').format('YYYY-MM-DD');
}

if (this.$isAppModeSocialWork && !this.isPublicSearch) {
this.formData.licenseScope.value = 'multi-state';
Comment thread
jsandoval81 marked this conversation as resolved.
}

this.validateAll({ asTouched: true });
await nextTick();
const submitButton = document.getElementById('submit');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,12 @@
:title="(formData.homeState.isDisabled) ? $t('licensing.searchStateDisabled') : ''"
/>
</div>
<div v-if="$isAppModeSocialWork && !isPublicSearch" class="search-form-row">
<InputSelect
:formInput="formData.licenseScope"
class="search-input license-scope-select"
/>
</div>
<div v-if="$isAppGroupModeMultiState" class="search-form-row">
<InputText
:formInput="formData.licenseNumber"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -312,7 +312,7 @@ class LicenseeSearch extends mixins(MixinForm) {
}
if (this.$isAppModeSocialWork) {
this.formData.licenseType.value = 'licensed clinical social worker';
this.formData.cuid.value = 'SwC-8879-1510662364862837507201851701209841388880384284903247330';
this.formData.cuid.value = 'SwC-8879-15106';
}

this.validateAll({ asTouched: true });
Expand Down
1 change: 1 addition & 0 deletions webroot/src/locales/en.json
Original file line number Diff line number Diff line change
Expand Up @@ -656,6 +656,7 @@
"jurisdictionFeeMilitary": "State Fee (Military)",
"licenseTypeSearch": "Profession type",
"licenseType": "License type",
"licenseScope": "License scope",
"category": "Category",
"adverseActions": "Adverse actions",
"status": "Status",
Expand Down
1 change: 1 addition & 0 deletions webroot/src/locales/es.json
Original file line number Diff line number Diff line change
Expand Up @@ -625,6 +625,7 @@
"purchaseFormErrorMessage": "Por favor, corrija los errores del formulario que se muestran en rojo.",
"licenseTypeSearch": "Tipo de profesión",
"licenseType": "Tipo de licencia",
"licenseScope": "Alcance de la licencia",
"category": "Categoría",
"adverseActions": "Acciones adversas",
"status": "Estado",
Expand Down
Loading
Loading