Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
microsoft
GitHub Repository: microsoft/vscode
Path: blob/main/extensions/copilot/src/platform/parser/test/node/getStructure.tsx.spec.ts
13405 views
1
/*---------------------------------------------------------------------------------------------
2
* Copyright (c) Microsoft Corporation. All rights reserved.
3
* Licensed under the MIT License. See License.txt in the project root for license information.
4
*--------------------------------------------------------------------------------------------*/
5
6
import { afterAll, describe, expect, test } from 'vitest';
7
import { _dispose } from '../../node/parserImpl';
8
import { WASMLanguage } from '../../node/treeSitterLanguages';
9
import { fromFixture, srcWithAnnotatedStructure } from './getStructure.util';
10
11
describe('getStructure - tsx', () => {
12
afterAll(() => _dispose());
13
14
function tsxSrcWithStructure(source: string) {
15
return srcWithAnnotatedStructure(WASMLanguage.TypeScriptTsx, source);
16
}
17
18
test('tsx source with different syntax constructs', async () => {
19
20
const source = await fromFixture('test.tsx');
21
22
expect(await tsxSrcWithStructure(source)).toMatchSnapshot();
23
});
24
25
test('issue #7487', async () => {
26
27
const source = await fromFixture('EditForm.tsx');
28
29
expect(await tsxSrcWithStructure(source)).toMatchSnapshot();
30
});
31
});
32
33