Skip to content

Commit 341cc6d

Browse files
committed
AssayPicker.test.tsx test case for General only provider set
1 parent f38a137 commit 341cc6d

1 file changed

Lines changed: 40 additions & 0 deletions

File tree

packages/components/src/internal/components/assay/AssayPicker.test.tsx

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,21 @@ const load = (): Promise<any> => {
1414
return Promise.resolve(getAssayDesignSectionOptions);
1515
};
1616

17+
const loadGeneralOnly = (): Promise<any> => {
18+
return Promise.resolve({
19+
"locations" : {
20+
"ea7c355b-0b2e-1039-8359-225b19643884" : "Current Folder (BiologicsAssayTest Project)",
21+
"ce3fb429-92f9-1038-8523-225b19648208" : "Shared Folder"
22+
},
23+
"providers" : [ {
24+
"name" : "General",
25+
"description" : "Imports data from simple Excel or TSV files.",
26+
"fileTypes" : [ ".tsv", ".csv", ".xls", ".xlsx", ".txt", ".fna", ".fasta" ]
27+
} ],
28+
"defaultLocation" : "ea7c355b-0b2e-1039-8359-225b19643884"
29+
});
30+
};
31+
1732
describe('AssayPicker', () => {
1833
test('AssayPicker', async () => {
1934
renderWithAppContext(
@@ -60,4 +75,29 @@ describe('AssayPicker', () => {
6075
expect(document.querySelectorAll('#assay-type-select-container')).toHaveLength(0);
6176
expect(document.querySelectorAll('.alert-info')).toHaveLength(1);
6277
});
78+
79+
test('AssayPicker General provider only', async () => {
80+
renderWithAppContext(
81+
<AssayPicker
82+
defaultTab={AssayPickerTabs.SPECIALTY_ASSAY_TAB}
83+
hasPremium={false}
84+
loadOptions={loadGeneralOnly}
85+
onChange={jest.fn()}
86+
showContainerSelect={false}
87+
showImport={false}
88+
/>
89+
);
90+
91+
await waitFor(() => {
92+
expect(document.querySelectorAll('.nav-tabs li')).toHaveLength(2);
93+
});
94+
95+
// Verify only two tabs and specialty tab selected
96+
expect(document.querySelectorAll('.nav-tabs li')).toHaveLength(2);
97+
expect(document.querySelectorAll('.nav-tabs li')[0].textContent).toEqual('Standard Assay');
98+
expect(document.querySelectorAll('.nav-tabs li')[1].textContent).toEqual('Specialty Assays');
99+
expect(document.querySelectorAll('.nav-tabs li')[1].getAttribute('class')).toEqual('active');
100+
expect(document.querySelectorAll('#assay-type-select-container')).toHaveLength(0);
101+
expect(document.querySelectorAll('.alert-info')).toHaveLength(1);
102+
});
63103
});

0 commit comments

Comments
 (0)