11// import * as assert from 'assert' -- this one is from node
22import { Parser } from '../../parser' ;
33import * as path from 'path' ;
4- import { beforeEach , expect , test } from '@jest/globals' ;
4+ import { beforeEach , beforeAll , expect , test } from '@jest/globals' ;
55
66// You can import and use all API from the 'vscode' module
77// as well as import your extension to test it
@@ -15,8 +15,7 @@ describe('Parser Test Suite', () => {
1515 describe ( 'It initializes correctly' , ( ) => {
1616 beforeEach ( ( ) => {
1717 // declare var and assign it to a test file and make new instance of Parser
18- file = path . join ( __dirname , '../test_cases/tc_0/index.js' ) ;
19- // file = path.join(__dirname, '../../../src/test/test_apps/test_0/index.js');
18+ file = path . join ( __dirname , '../../../../src/test/test_cases/tc_0/index.js' ) ;
2019 parser = new Parser ( file ) ;
2120 } ) ;
2221
@@ -31,30 +30,32 @@ describe('Parser Test Suite', () => {
3130 } ) ;
3231
3332 // TEST 0: ONE CHILD
34- it ( 'It works for simple apps' , ( ) => {
33+ describe ( 'It works for simple apps' , ( ) => {
3534 beforeAll ( ( ) => {
36- console . log ( '-----test 0----------' )
37- file = path . join ( __dirname , '../test_cases/tc_0/index.js' ) ;
35+ // console.log('-----test 0----------')
36+ file = path . join ( __dirname , '../../../../src/test/ test_cases/tc_0/index.js' ) ;
3837 parser = new Parser ( file ) ;
3938 tree = parser . parse ( ) ;
39+ console . log ( 'tree' , tree ) ;
4040 } ) ;
4141
4242 test ( 'It returns an defined object tree when parsed' , ( ) => {
4343 expect ( tree ) . toBeDefined ( ) ;
44- // expect(tree).toMatchObject()
44+ expect ( typeof ( tree ) ) . toBe ( 'object' ) ;
4545 } ) ;
4646
4747 test ( 'Parsed tree has a property called name with value index and one child with name App' , ( ) => {
48- expect ( tree ) . toHaveProperty ( 'index' ) ;
49- console . log ( '--------------index---------' ) ;
48+ expect ( tree ) . toHaveProperty ( 'name' , 'index' ) ;
49+ // console.log('--------------index---------');
50+ expect ( tree . children [ 0 ] ) . toHaveProperty ( 'name' , 'App' ) ;
5051 } ) ;
5152 } ) ;
5253
5354 // TEST 1: NESTED CHILDREN
5455
5556 describe ( 'It checks for nested Children' , ( ) => {
5657 beforeEach ( ( ) => {
57- file = path . join ( __dirname , '../test_cases/tc_1/index.js' ) ;
58+ file = path . join ( __dirname , '../../../../ test_cases/tc_1/index.js' ) ;
5859 // file = path.join(__dirname, '../../../src/test/test_apps/test_0/index.js');
5960 parser = new Parser ( file ) ;
6061 } )
0 commit comments