1+ // import * as assert from 'assert' -- this one is from node
2+ import { Parser } from '../../parser' ;
3+ import * as path from 'path' ;
4+ import { beforeEach , expect , test } from '@jest/globals' ;
5+
6+ // You can import and use all API from the 'vscode' module
7+ // as well as import your extension to test it
8+ import * as vscode from 'vscode'
9+ // const myExtension = require('../extension');
10+
11+ describe ( 'Parser Test Suite' , ( ) => {
12+ beforeEach ( ( ) => {
13+ vscode . window . showInformationMessage ( 'Start all tests.' ) ;
14+ } ) ;
15+
16+ let parser , tree , file ;
17+
18+ // UNPARSED TREE TEST
19+ describe ( 'It initializes correctly' , ( ) => {
20+ beforeEach ( ( ) => {
21+ // 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' ) ;
25+ parser = new Parser ( file ) ;
26+ } ) ;
27+
28+ test ( 'It instantiates an object for the parser class' , ( ) => {
29+ expect ( ( parser ) ) . toBeInstanceOf ( Parser ) ;
30+ // assert.typeOf(parser, 'object', 'Value of new instance should be an object');
31+ // expect(parser).to.be.an('object');
32+ } ) ;
33+
34+ test ( 'It begins with a suitable entry file and a tree that is not yet defined' , ( ) => {
35+ expect ( parser . entryFile ) . toEqual ( file ) ;
36+ 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');
40+ } ) ;
41+ } ) ;
42+
43+ // TEST ?: UNPARSED TREE TEST FOR REACT 18(createRoot)
44+
45+ // 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+ // });
52+
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+ // });
57+
58+ // TEST 0.5: CHECK IF COMPONENT IS CLIENT OR SERVER (USING HOOKS) => RENDERS A CERTAIN COLOR
59+ // TEST 1: NESTED CHILDREN
60+ // TEST 2: THIRD PARTY, REACT ROUTER, DESTRUCTURED IMPORTS
61+ // TEST 3: IDENTIFIES REDUX STORE CONNECTION
62+ // TEST 4: ALIASED IMPORTS
63+ // TEST 5: MISSING EXTENSIONS AND UNUSED IMPORTS
64+ // TEST 6: BAD IMPORT OF APP2 FROM APP1 COMPONENT
65+ // TEST 7: SYNTAX ERROR IN APP FILE CAUSES PARSER ERROR
66+ // TEST 8: MULTIPLE PROPS ON ONE COMPONENT
67+ // TEST 9: FINDING DIFFERENT PROPS ACROSS TWO OR MORE IDENTICAL COMPONENTS
68+ // TEST 10: CHECK CHILDREN WORKS AND COMPONENTS WORK
69+ // 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+ } ) ;
0 commit comments