mirror of
https://gitlab.com/openstapps/openstapps.git
synced 2026-01-06 21:42:49 +00:00
feat: tests
This commit is contained in:
79
packages/easy-ast/test/project/array-like.ast-test.ts
Normal file
79
packages/easy-ast/test/project/array-like.ast-test.ts
Normal file
@@ -0,0 +1,79 @@
|
||||
/* eslint-disable @typescript-eslint/no-unused-vars,@typescript-eslint/no-empty-interface */
|
||||
/*
|
||||
* Copyright (C) 2021 StApps
|
||||
* This program is free software: you can redistribute it and/or modify it
|
||||
* under the terms of the GNU General Public License as published by the Free
|
||||
* Software Foundation, version 3.
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful, but WITHOUT
|
||||
* ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
|
||||
* FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
|
||||
* more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License along with
|
||||
* this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
import {EasyAstSpecType} from '../easy-ast-spec-type.js';
|
||||
import {LightweightDefinitionKind} from '../../src/index.js';
|
||||
|
||||
interface Random {}
|
||||
|
||||
// @ts-expect-error unused type
|
||||
type TestArrayGeneric = Array<string>;
|
||||
// @ts-expect-error unused type
|
||||
type TestArrayLiteral = number[];
|
||||
// @ts-expect-error unused type
|
||||
type TestArrayReferenceGeneric = Array<Random>;
|
||||
// @ts-expect-error unused type
|
||||
type TestArrayReferenceLiteral = Random[];
|
||||
|
||||
export const testConfig: EasyAstSpecType = {
|
||||
testName: `should resolve array-likes`,
|
||||
expected: {
|
||||
TestArrayGeneric: {
|
||||
name: 'TestArrayGeneric',
|
||||
kind: LightweightDefinitionKind.ALIAS_LIKE,
|
||||
modifiers: ['type'],
|
||||
type: {
|
||||
value: 'string',
|
||||
flags: 4,
|
||||
isArray: true,
|
||||
},
|
||||
},
|
||||
TestArrayLiteral: {
|
||||
name: 'TestArrayLiteral',
|
||||
kind: LightweightDefinitionKind.ALIAS_LIKE,
|
||||
modifiers: ['type'],
|
||||
type: {
|
||||
value: 'number',
|
||||
flags: 8,
|
||||
isArray: true,
|
||||
},
|
||||
},
|
||||
TestArrayReferenceGeneric: {
|
||||
name: 'TestArrayReferenceGeneric',
|
||||
kind: LightweightDefinitionKind.ALIAS_LIKE,
|
||||
modifiers: ['type'],
|
||||
type: {
|
||||
referenceName: 'Random',
|
||||
flags: 524_288,
|
||||
isArray: true,
|
||||
},
|
||||
},
|
||||
TestArrayReferenceLiteral: {
|
||||
name: 'TestArrayReferenceLiteral',
|
||||
kind: LightweightDefinitionKind.ALIAS_LIKE,
|
||||
modifiers: ['type'],
|
||||
type: {
|
||||
referenceName: 'Random',
|
||||
flags: 524_288,
|
||||
isArray: true,
|
||||
},
|
||||
},
|
||||
Random: {
|
||||
name: 'Random',
|
||||
kind: LightweightDefinitionKind.CLASS_LIKE,
|
||||
modifiers: ['interface'],
|
||||
},
|
||||
},
|
||||
};
|
||||
Reference in New Issue
Block a user