11import "@testing-library/jest-dom" ;
2- import { cleanup , render , screen } from "@testing-library/react" ;
2+ import { cleanup , render } from "@testing-library/react" ;
33
44import * as React from "react" ;
55
@@ -16,7 +16,7 @@ const props = {
1616 ] ,
1717 name : "test_part" ,
1818 seq : "ATGGTAGTTAGATAGGGATACCGATAGACTTGAGAGATACCGCATCTATTTACGACCAGCGAGCAG" ,
19- testSize : { height : 600 , width : 800 } ,
19+ testSize : { height : 900 , width : 800 } ,
2020} ;
2121
2222describe ( "SeqViz rendering (React)" , ( ) => {
@@ -50,30 +50,30 @@ describe("SeqViz rendering (React)", () => {
5050 } ) ;
5151
5252 it ( "renders with Genbank file string input" , async ( ) => {
53- render ( < SeqViz { ...props } file = { demoPart } /> ) ;
54- expect ( screen . getAllByTestId ( "la-vz-seqviz" ) ) . toBeTruthy ( ) ;
55-
56- expect ( screen . getAllByTestId ( "la-vz-viewer-container" ) ) . toHaveLength ( 1 ) ;
53+ const { getAllByTestId } = render ( < SeqViz { ...props } file = { demoPart } /> ) ;
54+ expect ( getAllByTestId ( "la-vz-seqviz" ) ) . toBeTruthy ( ) ;
55+ expect ( getAllByTestId ( "la-vz-viewer-container" ) ) . toHaveLength ( 1 ) ;
5756
5857 // Verify the file's sequence is rendered.
5958 // The linear viewer will cut off the end, this is just the prefix
60- const seqs = screen . getAllByTestId ( "la-vz-seq" ) ;
59+ const seqs = getAllByTestId ( "la-vz-seq" ) ;
6160 const seq = seqs . map ( s => s . textContent ) . join ( "" ) ;
6261 expect ( seq ) . toContain ( "ttgacagctagctcagtcctaggtactgtgctagcta" ) ;
6362 } ) ;
6463
6564 it ( "renders with an Amino Acid sequence" , ( ) => {
6665 const aaSeq =
67- "MSKGEELFTGVVPILVELDGDVNGHKFSVSGEGEGDATYGKLTLKFICTTGKLPVPWPTLVTTFSYGVQCFSRYPDHMKQHDFFKSAMPEGYVQERTIFFKDDGNYKTRAEVKFEGDTLVNRIELKGIDFKEDGNILGHKLEYNYNSHNVYIMADKQKNGIKVNFKIRHNIEDGSVQLADHYQQNTPIGDGPVLLPDNHYLSTQSALSKDPNEKRDHMVLLEFVTAAGITHGMDELYK *" ;
66+ "MSKGEELFTGVVPILVELDGDVNGHKFSVSGEGEGDATYGKLTLKFICTTGKLPVPWPTLVTTFSYGVQCFSRYPDHMKQHDFFKSAMPEGYVQERTIFFKDDGDNHYLSTQSALSKDPNEKRDHMVLLEFVTAAGITHGMDELYK *" ;
6867
69- const { getAllByTestId, getByTestId } = render ( < SeqViz { ...props } seq = { aaSeq } seqType = "aa" viewer = "linear" /> ) ;
68+ const { getAllByTestId, getByTestId } = render ( < SeqViz { ...props } seq = { aaSeq } viewer = "linear" /> ) ;
7069 expect ( getAllByTestId ( "la-vz-seqviz" ) ) . toBeTruthy ( ) ;
7170 expect ( getByTestId ( "la-vz-viewer-linear" ) ) . toBeTruthy ( ) ;
7271 expect ( getAllByTestId ( "la-vz-viewer-linear" ) ) . toHaveLength ( 1 ) ;
7372
74- // const seqs = getAllByTestId("la-vz-translation");
75- // const seq = seqs.map(s => s.textContent).join("");
76- // expect(seq).toEqual(aaSeq);
73+ const seqs = getAllByTestId ( "la-vz-linear-translation" ) ;
74+ const seq = seqs . map ( s => s . textContent ) . join ( "" ) ;
75+ expect ( seq . length ) . toBeGreaterThan ( 0 ) ;
76+ expect ( aaSeq ) . toContain ( seq ) ;
7777 } ) ;
7878
7979 it ( "renders with an externally set Selection prop" , ( ) => {
0 commit comments