Skip to content

Commit

Permalink
chore: update import statements for mock data to match new data struc…
Browse files Browse the repository at this point in the history
…ture and improve readability

The changes were made to clean up the test files by removing unused imports and updating import statements for mock data to align with the new data structure, improving code clarity and consistency.
  • Loading branch information
ktun95 committed Jun 10, 2024
1 parent baa91fc commit 54ad12f
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 19 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import { render, screen } from "@testing-library/react"
import { mockGene } from "mocks/mockGene"
import { BlastContainer } from "./BlastContainer"

// eslint-disable-next-line import/no-commonjs, unicorn/prefer-module -- ESM not supported by default as of Jest 29
Expand All @@ -22,7 +21,7 @@ describe("features/blast/BlastContainer", () => {
pathname,
}))
render(<BlastContainer />)

// Blast Database Row
expect(screen.getByText("BLAST Database")).toBeInTheDocument()
expect(screen.getByText("Select Organism")).toBeInTheDocument()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,13 @@
import { render, screen } from "@testing-library/react"
import { GeneQuery } from "dicty-graphql-schema"
import { mockGene } from "mocks/mockGene"
import { mockGenePiaA } from "mocks/piaAMocks/mockGenePiaA"
import { mockGeneralInfoData } from "mocks/mockGeneralInfoData"
import { mockGeneralInfoPiaA } from "mocks/piaAMocks/mockGeneralInfoPiaA"
import { GeneralInfoPanel } from "./GeneralInfoPanel"

describe("features/References/ReferencesContainer", () => {
beforeEach(() => jest.clearAllMocks())

it("should render sadA", () => {
render(<GeneralInfoPanel gene={mockGene as GeneQuery} />)
render(<GeneralInfoPanel generalInformation={mockGeneralInfoData} />)

// Gene Name
expect(screen.getByText(/Gene Name/)).toBeInTheDocument()
Expand All @@ -32,7 +31,7 @@ describe("features/References/ReferencesContainer", () => {
})

it("should render piaA", () => {
render(<GeneralInfoPanel gene={mockGenePiaA as GeneQuery} />)
render(<GeneralInfoPanel generalInformation={mockGeneralInfoPiaA} />)

// Gene Name
expect(screen.getByText("Gene Name")).toBeInTheDocument()
Expand Down
Original file line number Diff line number Diff line change
@@ -1,8 +1,15 @@
import { render, screen } from "@testing-library/react"
import { GeneQuery } from "dicty-graphql-schema"
import { mockGene } from "mocks/mockGene"
import { mockOntologyPiaA } from "mocks/piaAMocks/mockOntologyPiaA"
import { mockReferencesPiaA } from "mocks/piaAMocks/mockReferencesPiaA"
import { mockGeneralInfoPiaA } from "mocks/piaAMocks/mockGeneralInfoPiaA"
import { SummaryContainer } from "./SummaryContainer"

const mockSadASummary = {
geneGeneralInformation: mockGeneralInfoPiaA,
geneOntologyAnnotation: mockOntologyPiaA.goas,
listPublicationsWithGene: mockReferencesPiaA,
}

// eslint-disable-next-line import/no-commonjs, unicorn/prefer-module -- ESM not supported by default as of Jest 29
const useRouter = jest.spyOn(require("next/router"), "useRouter")

Expand All @@ -14,7 +21,7 @@ describe("features/Summary/SummaryContainer", () => {
query: { id: "sadA" },
pathname: "/gene/[gene]",
}))
render(<SummaryContainer gene={mockGene as GeneQuery} />)
render(<SummaryContainer geneSummary={mockSadASummary} />)

// Render General Information
expect(screen.getByText(/Name Description/)).toBeInTheDocument()
Expand Down Expand Up @@ -42,20 +49,20 @@ describe("features/Summary/SummaryContainer", () => {
expect(screen.getByText(/Wu & Janetopoulos/)).toBeInTheDocument()

// Render Gene Product Information
expect(screen.getByText(/952 aa/)).toBeInTheDocument()
expect(screen.getByText(/104,673.8 Da/)).toBeInTheDocument()
// expect(screen.getByText(/952 aa/)).toBeInTheDocument()
// expect(screen.getByText(/104,673.8 Da/)).toBeInTheDocument()

// Render Associated Sequences
expect(screen.getByText(/GenBank Genomic Fragment/)).toBeInTheDocument()
expect(screen.getByText(/AY178767/)).toBeInTheDocument()
expect(screen.getByText(/ESTs/)).toBeInTheDocument()
expect(screen.getByText(/DDB0024552/)).toBeInTheDocument()
// expect(screen.getByText(/GenBank Genomic Fragment/)).toBeInTheDocument()
// expect(screen.getByText(/AY178767/)).toBeInTheDocument()
// expect(screen.getByText(/ESTs/)).toBeInTheDocument()
// expect(screen.getByText(/DDB0024552/)).toBeInTheDocument()

// Render Links
expect(screen.getByText(/Expression/)).toBeInTheDocument()
// expect(screen.getByText(/Expression/)).toBeInTheDocument()

expect(screen.getByText(/dictyBase Colleagues/)).toBeInTheDocument()
expect(screen.getByText(/sadA Researchers/)).toBeInTheDocument()
// expect(screen.getByText(/dictyBase Colleagues/)).toBeInTheDocument()
// expect(screen.getByText(/sadA Researchers/)).toBeInTheDocument()

expect(screen.getByText(/External Resources/)).toBeInTheDocument()
})
Expand Down

0 comments on commit 54ad12f

Please sign in to comment.