11import fs from 'node:fs' ;
22
3- import { describe , it , expect } from 'vitest' ;
3+ import { describe , expect , it } from 'vitest' ;
44
55import { parse } from '..' ;
66
7- let sdf = fs . readFileSync ( `${ __dirname } /test.sdf` , 'utf8' ) ;
8- let sdf1 = fs . readFileSync ( `${ __dirname } /test1.sdf` , 'utf8' ) ;
7+ const sdf = fs . readFileSync ( `${ __dirname } /test.sdf` , 'utf8' ) ;
8+ const sdf1 = fs . readFileSync ( `${ __dirname } /test1.sdf` , 'utf8' ) ;
99
1010describe ( 'SDF Parser' , ( ) => {
11- let result = parse ( sdf ) ;
11+ const result = parse ( sdf ) ;
1212
1313 it ( 'Check statistics' , ( ) => {
1414 expect ( result . statistics [ 0 ] . counter ) . toBe ( 128 ) ;
@@ -25,6 +25,7 @@ describe('SDF Parser', () => {
2525
2626 it ( 'Check molecules' , ( ) => {
2727 let molecule = result . molecules [ 0 ] ;
28+
2829 expect ( molecule . Code ) . toContain ( '0100380824' ) ;
2930 expect ( molecule . CLogP ) . toBe ( 2.7 ) ;
3031 expect ( molecule . molfile . split ( '\n' ) ) . toHaveLength ( 37 ) ;
@@ -33,18 +34,18 @@ describe('SDF Parser', () => {
3334 it ( 'should throw with non-string argument' , ( ) => {
3435 expect ( ( ) => {
3536 parse ( ) ;
36- } ) . toThrow ( TypeError ) ;
37+ } ) . toThrowError ( TypeError ) ;
3738 expect ( ( ) => {
3839 parse ( 42 ) ;
39- } ) . toThrow ( TypeError ) ;
40+ } ) . toThrowError ( TypeError ) ;
4041 expect ( ( ) => {
4142 parse ( { } ) ;
42- } ) . toThrow ( TypeError ) ;
43+ } ) . toThrowError ( TypeError ) ;
4344 } ) ;
4445} ) ;
4546
4647describe ( 'SDF Parser no dynamicTyping' , ( ) => {
47- let result = parse ( sdf , {
48+ const result = parse ( sdf , {
4849 dynamicTyping : false ,
4950 } ) ;
5051
@@ -63,6 +64,7 @@ describe('SDF Parser no dynamicTyping', () => {
6364
6465 it ( 'Check molecules' , ( ) => {
6566 let molecule = result . molecules [ 0 ] ;
67+
6668 expect ( typeof molecule . Code ) . toBe ( 'string' ) ;
6769 expect ( typeof molecule . CLogP ) . toBe ( 'string' ) ;
6870 expect ( molecule . CLogP ) . toBe ( '2.700000000000000e+000' ) ;
@@ -71,8 +73,9 @@ describe('SDF Parser no dynamicTyping', () => {
7173} ) ;
7274
7375describe ( 'SDF Parser one molecule' , ( ) => {
74- let result = parse ( sdf1 ) ;
7576 it ( 'Check statistics' , ( ) => {
77+ const result = parse ( sdf1 ) ;
78+
7679 expect ( result . molecules ) . toHaveLength ( 1 ) ;
7780 } ) ;
7881} ) ;
0 commit comments