@@ -30,7 +30,7 @@ describe("Molecule component", () => {
3030 { x : 0 , y : 0 , element : "C" } ,
3131 { x : 10 , y : 10 , element : "C" } ,
3232 ] ,
33- bonds : [ { atoms : [ 0 , 1 ] , bond : "SINGLE" } ] ,
33+ bonds : [ { atoms : [ [ 0 , 1 , "SINGLE" ] ] } ] ,
3434 } ;
3535 const { container } = render ( < Molecule molecule = { data } /> ) ;
3636
@@ -49,7 +49,45 @@ describe("Molecule component", () => {
4949 { x : 0 , y : 0 , element : "Cl" } ,
5050 { x : 10 , y : 10 , element : "Cl" } ,
5151 ] ,
52- bonds : [ { atoms : [ 0 , 1 ] , bond : "DOUBLE" } ] ,
52+ bonds : [ { atoms : [ [ 0 , 1 , "DOUBLE" ] ] } ] ,
53+ } ;
54+ const { container } = render ( < Molecule molecule = { data } /> ) ;
55+
56+ // chlorine atom labels should displayed
57+ expect ( screen . queryAllByText ( "Cl" ) ) . toHaveLength ( 2 ) ;
58+
59+ // The lines
60+ expect ( container . querySelectorAll ( "line" ) ) . toHaveLength ( 2 ) ;
61+ } ) ;
62+
63+ test ( "Display a triple bond" , ( ) => {
64+ const data : MoleculeData = {
65+ width : 10 ,
66+ height : 10 ,
67+ atoms : [
68+ { x : 0 , y : 0 , element : "Cl" } ,
69+ { x : 10 , y : 10 , element : "Cl" } ,
70+ ] ,
71+ bonds : [ { atoms : [ [ 0 , 1 , "TRIPLE" ] ] } ] ,
72+ } ;
73+ const { container } = render ( < Molecule molecule = { data } /> ) ;
74+
75+ // chlorine atom labels should displayed
76+ expect ( screen . queryAllByText ( "Cl" ) ) . toHaveLength ( 2 ) ;
77+
78+ // The lines
79+ expect ( container . querySelectorAll ( "line" ) ) . toHaveLength ( 3 ) ;
80+ } ) ;
81+
82+ test ( "Display an EitherDouble bond" , ( ) => {
83+ const data : MoleculeData = {
84+ width : 10 ,
85+ height : 10 ,
86+ atoms : [
87+ { x : 0 , y : 0 , element : "Cl" } ,
88+ { x : 10 , y : 10 , element : "Cl" } ,
89+ ] ,
90+ bonds : [ { atoms : [ [ 0 , 1 , "DOUBLE" ] ] , direction : "EITHERDOUBLE" } ] ,
5391 } ;
5492 const { container } = render ( < Molecule molecule = { data } /> ) ;
5593
@@ -68,7 +106,7 @@ describe("Molecule component", () => {
68106 { x : 0 , y : 0 , element : "Cl" } ,
69107 { x : 10 , y : 10 , element : "H" } ,
70108 ] ,
71- bonds : [ { atoms : [ 0 , 1 ] , bond : "SINGLE" , direction : "BEGINWEDGE" } ] ,
109+ bonds : [ { atoms : [ [ 0 , 1 , "SINGLE" ] ] , direction : "BEGINWEDGE" } ] ,
72110 } ;
73111 const { container } = render ( < Molecule molecule = { data } /> ) ;
74112
@@ -88,7 +126,7 @@ describe("Molecule component", () => {
88126 { x : 0 , y : 0 , element : "Cl" } ,
89127 { x : 10 , y : 10 , element : "C" } ,
90128 ] ,
91- bonds : [ { atoms : [ 0 , 1 ] , bond : "SINGLE" , direction : "BEGINWEDGE" } ] ,
129+ bonds : [ { atoms : [ [ 0 , 1 , "SINGLE" ] ] , direction : "BEGINWEDGE" } ] ,
92130 } ;
93131 const { container } = render ( < Molecule molecule = { data } /> ) ;
94132
@@ -108,7 +146,7 @@ describe("Molecule component", () => {
108146 { x : 0 , y : 0 , element : "Cl" } ,
109147 { x : 5 , y : 5 , element : "H" } ,
110148 ] ,
111- bonds : [ { atoms : [ 0 , 1 ] , bond : "SINGLE" , direction : "BEGINDASH" } ] ,
149+ bonds : [ { atoms : [ [ 0 , 1 , "SINGLE" ] ] , direction : "BEGINDASH" } ] ,
112150 } ;
113151 const { container } = render ( < Molecule molecule = { data } /> ) ;
114152
@@ -128,7 +166,7 @@ describe("Molecule component", () => {
128166 { x : 0 , y : 0 , element : "Cl" } ,
129167 { x : 5 , y : 5 , element : "C" } ,
130168 ] ,
131- bonds : [ { atoms : [ 0 , 1 ] , bond : "SINGLE" , direction : "BEGINDASH" } ] ,
169+ bonds : [ { atoms : [ [ 0 , 1 , "SINGLE" ] ] , direction : "BEGINDASH" } ] ,
132170 } ;
133171 const { container } = render ( < Molecule molecule = { data } /> ) ;
134172
@@ -152,7 +190,19 @@ describe("Molecule component", () => {
152190 { x : 0 , y : 2 , element : "F" } ,
153191 { x : 0 , y : 1 , element : "F" } ,
154192 ] ,
155- bonds : [ { atoms : [ 0 , 1 , 2 , 3 , 4 , 5 ] , bond : "AROMATIC" } ] ,
193+ bonds : [
194+ {
195+ atoms : [
196+ [ 0 , 1 , "SINGLE" ] ,
197+ [ 1 , 2 , "DOUBLE" ] ,
198+ [ 2 , 3 , "SINGLE" ] ,
199+ [ 3 , 4 , "DOUBLE" ] ,
200+ [ 4 , 5 , "SINGLE" ] ,
201+ [ 5 , 1 , "DOUBLE" ] ,
202+ ] ,
203+ tag : "RING" ,
204+ } ,
205+ ] ,
156206 } ;
157207 const { container } = render ( < Molecule molecule = { data } /> ) ;
158208
@@ -168,7 +218,7 @@ describe("Molecule component", () => {
168218 width : 10 ,
169219 height : 10 ,
170220 atoms : [ { x : 5 , y : 5 , element : "A" } ] ,
171- bonds : [ { atoms : [ ] , bond : "AROMATIC " } ] ,
221+ bonds : [ { atoms : [ ] , tag : "RING " } ] ,
172222 } ;
173223
174224 const { container } = render ( < Molecule molecule = { data } /> ) ;
@@ -185,7 +235,7 @@ describe("Molecule component", () => {
185235 { x : 0 , y : 0 , element : "Cl" } ,
186236 { x : 5 , y : 5 , element : "H" } ,
187237 ] ,
188- bonds : [ { atoms : [ 0 , 1 ] , bond : "UNSPECIFIED" } ] ,
238+ bonds : [ { atoms : [ [ 0 , 1 , "UNSPECIFIED" ] ] } ] ,
189239 } ;
190240 render ( < Molecule molecule = { data } /> ) ;
191241
0 commit comments