Skip to content

Commit

Permalink
test: add unit tests for data library base page
Browse files Browse the repository at this point in the history
  • Loading branch information
fboulnois committed Nov 15, 2024
1 parent 5fb3ce6 commit abc7bb6
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions cypress/component/DataSearch/dataset_search_page.spec.js
Original file line number Diff line number Diff line change
@@ -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('Data Library', () => {
// 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(<DatasetSearch {...props} />);
});

it('Renders the data library with a query', () => {
const props = { match: { params: { query: 'test' } } };
cy.stub(Storage, 'getCurrentUser').returns(duosUser);
mount(<DatasetSearch {...props} />);
});
});

0 comments on commit abc7bb6

Please sign in to comment.