From 20e10bf0d6c3b55d28ea5020ac94ef732790c414 Mon Sep 17 00:00:00 2001 From: Florian Boulnois Date: Fri, 15 Nov 2024 10:47:08 -0500 Subject: [PATCH] test: add unit tests for data library base page --- .../DataSearch/dataset_search_page.spec.js | 33 +++++++++++++++++++ 1 file changed, 33 insertions(+) create mode 100644 cypress/component/DataSearch/dataset_search_page.spec.js diff --git a/cypress/component/DataSearch/dataset_search_page.spec.js b/cypress/component/DataSearch/dataset_search_page.spec.js new file mode 100644 index 000000000..2af0d7d5f --- /dev/null +++ b/cypress/component/DataSearch/dataset_search_page.spec.js @@ -0,0 +1,33 @@ +/* eslint-disable no-undef */ + +import { mount } from 'cypress/react'; +import React from 'react'; +import {Storage} from '../../../src/libs/storage'; +import DatasetSearch from '../../../src/pages/DatasetSearch'; + +const duosUser = { + isSigningOfficial: false, +}; + +describe('User Profile', () => { + // Intercept configuration calls + beforeEach(() => { + cy.intercept({ + method: 'GET', + url: '/config.json', + hostname: 'localhost', + }, { 'env': 'ci' }); + }); + + it('Renders the data library without a query', () => { + const props = { match: { params: { query: undefined } } }; + cy.stub(Storage, 'getCurrentUser').returns(duosUser); + mount(); + }); + + it('Renders the data library with a query', () => { + const props = { match: { params: { query: 'test' } } }; + cy.stub(Storage, 'getCurrentUser').returns(duosUser); + mount(); + }); +});