@@ -9,9 +9,11 @@ import * as vscode from 'vscode'
99
1010describe ( 'Parser Test Suite' , ( ) => {
1111 let parser , tree , file ;
12+ const fs = require ( 'fs' ) ;
13+
1214
1315 // UNPARSED TREE TEST
14- describe ( 'It initializes correctly' , ( ) => {
16+ xdescribe ( 'It initializes correctly' , ( ) => {
1517 beforeEach ( ( ) => {
1618 // Assign the test file and make new instance of Parser
1719 file = path . join ( __dirname , '../test_cases/tc_0/index.js' ) ;
@@ -30,7 +32,7 @@ describe('Parser Test Suite', () => {
3032 } ) ;
3133
3234 // TEST 0: ONE CHILD
33- describe ( 'It works for simple apps' , ( ) => {
35+ xdescribe ( 'It works for simple apps' , ( ) => {
3436 beforeEach ( ( ) => {
3537 file = path . join ( __dirname , '' ) ;
3638 parser = new Parser ( file ) ;
@@ -47,6 +49,32 @@ describe('Parser Test Suite', () => {
4749 // });
4850 } ) ;
4951
52+ // TEST 6: BAD IMPORT OF APP2 FROM APP1 COMPONENT
53+ describe ( 'Catches bad imports' , ( ) => {
54+ beforeEach ( ( ) => {
55+ file = path . join ( __dirname , '../../../../src/test/test_cases/tc_6/component/App.jsx' ) ;
56+ parser = new Parser ( file ) ;
57+ tree = parser . parse ( ) ;
58+ } ) ;
59+
60+ test ( "Child component with bad file path does not show up on the node tree" , ( ) => {
61+ expect ( tree . children . length ) . toBe ( 0 ) ;
62+ } )
63+ } )
64+
65+ // TEST 7: SYNTAX ERROR IN APP FILE CAUSES PARSER ERROR
66+ describe ( 'Parser should not work for components with syntax errors in the code' , ( ) => {
67+ beforeEach ( ( ) => {
68+ file = path . join ( __dirname , '../../../../src/test/test_cases/tc_7/index.js' ) ;
69+ parser = new Parser ( file ) ;
70+ tree = parser . parse ( ) ;
71+ } ) ;
72+
73+ test ( "Parser stops parsing when there is a syntax error in a component" , ( ) => {
74+ expect ( tree . children . length ) . toBe ( 0 ) ;
75+ } ) ;
76+ } )
77+
5078 // these are the 14 tests we need to test for
5179
5280 // TEST 1: NESTED CHILDREN
0 commit comments