@@ -9,64 +9,62 @@ import * as vscode from 'vscode'
99// const myExtension = require('../extension');
1010
1111describe ( 'Parser Test Suite' , ( ) => {
12- // beforeEach(() => {
13- // vscode.window.showInformationMessage('Start all tests.');
14- // });
15-
1612 let parser , tree , file ;
1713
1814 // UNPARSED TREE TEST
1915 describe ( 'It initializes correctly' , ( ) => {
2016 beforeEach ( ( ) => {
2117 // declare var and assign it to a test file and make new instance of Parser
22- // both of the paths below work
23- // file = path.join(__dirname, '../test_cases/tc_0/index.js');
24- file = path . join ( __dirname , '../../../src/test/test_apps/test_0/index.js' ) ;
18+ file = path . join ( __dirname , '../test_cases/tc_0/index.js' ) ;
19+ // file = path.join(__dirname, '../../../src/test/test_apps/test_0/index.js');
2520 parser = new Parser ( file ) ;
2621 } ) ;
2722
2823 test ( 'It instantiates an object for the parser class' , ( ) => {
2924 expect ( ( parser ) ) . toBeInstanceOf ( Parser ) ;
30- // assert.typeOf(parser, 'object', 'Value of new instance should be an object');
31- // expect(parser).to.be.an('object');
3225 } ) ;
3326
3427 test ( 'It begins with a suitable entry file and a tree that is not yet defined' , ( ) => {
3528 expect ( parser . entryFile ) . toEqual ( file ) ;
3629 expect ( tree ) . toBeUndefined ( ) ;
37- // below is my code
38- // assert.strictEqual(parser.entryFile, file, 'These files are strictly equal');
39- // assert.isUndefined(tree, 'Tree is defined');
4030 } ) ;
4131 } ) ;
4232
43- // TEST ?: UNPARSED TREE TEST FOR REACT 18(createRoot)
44-
4533 // TEST 0: ONE CHILD
46- // describe('It works for simple apps', () => {
47- // before(() => {
48- // file = path.join(__dirname, '');
49- // parser = new Parser(file);
50- // tree = parser.parse();
51- // });
34+ describe ( 'It works for simple apps' , ( ) => {
35+ before ( ( ) => {
36+ file = path . join ( __dirname , '' ) ;
37+ parser = new Parser ( file ) ;
38+ tree = parser . parse ( ) ;
39+ } ) ;
40+
41+ test ( 'It returns an defined object tree when parsed' , ( ) => {
42+ expect ( tree ) . toBeDefined ( ) ;
43+ //expect(tree).toMatchObject()
44+ } ) ;
5245
53- // test('It returns an defined object tree when parsed ', () => {
54- // assert.typeOf(tree, 'object', 'Value of parse() on new instance should be an object');
55- // });
56- // });
46+ test ( 'Parsed tree has a property called name with value index and one child with name App ' , ( ) => {
47+
48+ } ) ;
49+ } ) ;
5750
58- // TEST 0.5: CHECK IF COMPONENT IS CLIENT OR SERVER (USING HOOKS) => RENDERS A CERTAIN COLOR
5951 // TEST 1: NESTED CHILDREN
6052 // TEST 2: THIRD PARTY, REACT ROUTER, DESTRUCTURED IMPORTS
6153 // TEST 3: IDENTIFIES REDUX STORE CONNECTION
6254 // TEST 4: ALIASED IMPORTS
6355 // TEST 5: MISSING EXTENSIONS AND UNUSED IMPORTS
56+
57+ // ashley
6458 // TEST 6: BAD IMPORT OF APP2 FROM APP1 COMPONENT
6559 // TEST 7: SYNTAX ERROR IN APP FILE CAUSES PARSER ERROR
6660 // TEST 8: MULTIPLE PROPS ON ONE COMPONENT
6761 // TEST 9: FINDING DIFFERENT PROPS ACROSS TWO OR MORE IDENTICAL COMPONENTS
62+
6863 // TEST 10: CHECK CHILDREN WORKS AND COMPONENTS WORK
6964 // TEST 11: PARSER DOESN'T BREAK UPON RECURSIVE COMPONENTS
70- // TEST 12: NEXT.JS APPS (pages & app router)
71- // TEST 13: Variable Declaration Imports and React.lazy Imports
72- } ) ;
65+ // TEST 12: NEXT.JS APPS (pages version & app router version)
66+ // TEST 13: Variable Declaration Imports and React.lazy Imports
67+ // TEST 14: CHECK IF COMPONENT IS CLIENT OR SERVER (USING HOOKS) => RENDERS A CERTAIN COLOR (priority)
68+
69+ // LOU - EXTENSION TEST
70+ } ) ;
0 commit comments