Skip to content

Commit

Permalink
Move tests folder out of src
Browse files Browse the repository at this point in the history
  • Loading branch information
jafeltra committed Aug 8, 2024
1 parent 5341ec7 commit e5972a2
Show file tree
Hide file tree
Showing 19 changed files with 25 additions and 20 deletions.
4 changes: 2 additions & 2 deletions src/tests/App.test.jsx → tests/App.test.jsx
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { waitFor, render, fireEvent } from '@testing-library/react';
import App, { decodeFSH } from '../App';
import * as bitlyWorker from '../utils/BitlyWorker';
import App, { decodeFSH } from '../src/App';
import * as bitlyWorker from '../src/utils/BitlyWorker';

it('basic app renders', () => {
const { getByText } = render(<App match={{}} />);
Expand Down
4 changes: 2 additions & 2 deletions src/tests/AppRouter.test.jsx → tests/AppRouter.test.jsx
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
import React from 'react';
import { render } from '@testing-library/react';
import { MemoryRouter } from 'react-router-dom';
import AppRouter from '../AppRouter';
import AppRouter from '../src/AppRouter';

vi.mock('../App.jsx', () => ({ default: () => <div>Mock FSH Online</div> }));
vi.mock('../src/App.jsx', () => ({ default: () => <div>Mock FSH Online</div> }));

test('Renders FSH Online App when visiting /FSHOnline', () => {
const { getByText } = render(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { render, fireEvent, waitFor } from '@testing-library/react';
import { unmountComponentAtNode } from 'react-dom';
import CodeEditor from '../../components/CodeEditor';
import CodeEditor from '../../src/components/CodeEditor';

let container = null;
beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { render } from '@testing-library/react';
import { unmountComponentAtNode } from 'react-dom';
import Console from '../../components/Console';
import Console from '../../src/components/Console';

let container = null;
beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import 'fake-indexeddb/auto';
import { unmountComponentAtNode } from 'react-dom';
import { act } from 'react-dom/test-utils';
import { render, waitFor, fireEvent } from '@testing-library/react';
import FSHControls from '../../components/FSHControls';
import * as fshHelpers from '../../utils/FSHHelpers';
import FSHControls from '../../src/components/FSHControls';
import * as fshHelpers from '../../src/utils/FSHHelpers';

const badSUSHIPackage = { a: '1', b: '2' };
const emptySUSHIPackage = {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { render, fireEvent } from '@testing-library/react';
import { unmountComponentAtNode } from 'react-dom';
import FileSaver from 'file-saver';
import FSHOutput from '../../components/FSHOutput';
import FSHOutput from '../../src/components/FSHOutput';

let container = null;
beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import React from 'react';
import { render, fireEvent } from '@testing-library/react';
import { unmountComponentAtNode } from 'react-dom';
import FileSaver from 'file-saver';
import JSONOutput from '../../components/JSONOutput';
import JSONOutput from '../../src/components/JSONOutput';

let container = null;
beforeEach(() => {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import React from 'react';
import { render, waitFor, fireEvent } from '@testing-library/react';
import { unmountComponentAtNode } from 'react-dom';
import { act } from 'react-dom/test-utils';
import ShareLink from '../../components/ShareLink';
import * as bitlyWorker from '../../utils/BitlyWorker';
import ShareLink from '../../src/components/ShareLink';
import * as bitlyWorker from '../../src/utils/BitlyWorker';

// Mock copy to clipboard since we don't need to test the component itself
vi.mock('copy-to-clipboard', () => ({
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import React from 'react';
import { render } from '@testing-library/react';
import { unmountComponentAtNode } from 'react-dom';
import TopBar from '../../components/TopBar';
import TopBar from '../../src/components/TopBar';

let container = null;
beforeEach(() => {
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { runSUSHI, runGoFSH, getCoreFHIRPackageIdentifier } from '../../utils/FSHHelpers';
import * as processing from '../../utils/Processing';
import { runSUSHI, runGoFSH, getCoreFHIRPackageIdentifier } from '../../src/utils/FSHHelpers';
import * as processing from '../../src/utils/Processing';
import Patient from './fixtures/StructureDefinition-Patient.json';
import StructureDefinition from './fixtures/StructureDefinition-StructureDefinition.json';
import Quantity from './fixtures/StructureDefinition-Quantity.json';
Expand Down
7 changes: 6 additions & 1 deletion src/tests/utils/Load.test.js → tests/utils/Load.test.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
import { unzipDependencies, loadDependenciesInStorage, loadAsFHIRDefs, getLatestVersionNumber } from '../../utils/Load';
import {
unzipDependencies,
loadDependenciesInStorage,
loadAsFHIRDefs,
getLatestVersionNumber
} from '../../src/utils/Load';
import { fhirdefs } from 'fsh-sushi';
import path from 'path';
import nock from 'nock';
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ import {
fillTank,
loadExternalDependencies,
resolveDependencies
} from '../../utils/Processing';
} from '../../src/utils/Processing';
import { fhirdefs, sushiImport } from 'fsh-sushi';
import * as loadModule from '../../utils/Load';
import * as loadModule from '../../src/utils/Load';
import 'fake-indexeddb/auto';

const FHIRDefinitions = fhirdefs.FHIRDefinitions;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { sliceDependency } from '../../utils/helpers';
import { sliceDependency } from '../../src/utils/helpers';

describe('#sliceDependency()', () => {
it('should correctly parse a given array of dependencies', () => {
Expand Down
2 changes: 1 addition & 1 deletion vite.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,6 @@ export default defineConfig({
test: {
environment: 'jsdom',
globals: true,
setupFiles: 'src/setupTests.js'
setupFiles: 'tests/setupTests.js'
}
});

0 comments on commit e5972a2

Please sign in to comment.