1
- import { org } from "@modelix/model-client" ;
2
- import { LanguageRegistry } from "@modelix/ts-model-api" ;
3
1
import {
4
2
isOfConcept_INamedConcept ,
5
3
isOfConcept_PropertyAttribute ,
6
4
isOfConcept_Attribute ,
7
5
} from "../build/typescript_src/L_jetbrains_mps_lang_core" ;
8
- import { registerLanguages } from "../build/typescript_src " ;
6
+ import { useFakeNode } from "./test-helpers " ;
9
7
10
- registerLanguages ( ) ;
11
-
12
- const nodeData = {
13
- root : {
14
- children : [
15
- {
16
- // concecpt ID of an PropertyAttribute
17
- concept : "mps:ceab5195-25ea-4f22-9b92-103b95ca8c0c/3364660638048049750" ,
18
- role : "children1" ,
19
- properties : {
20
- name : "aName" ,
21
- } ,
22
- } ,
23
- ] ,
24
- } ,
25
- } ;
26
-
27
- const untypedNode = useRootNode ( nodeData ) . getChildren ( "children1" ) [ 0 ] ;
28
- const typedNode = LanguageRegistry . INSTANCE . wrapNode ( untypedNode ) ;
8
+ const { typedNode } = useFakeNode ( ) ;
29
9
30
10
test ( "verifies the concept of a node" , ( ) => {
31
11
expect ( isOfConcept_PropertyAttribute ( typedNode ) ) . toBeTruthy ( ) ;
@@ -43,12 +23,3 @@ test("nullish values are never of the type of the checked concept", () => {
43
23
expect ( isOfConcept_INamedConcept ( null ) ) . toBeFalsy ( ) ;
44
24
expect ( isOfConcept_INamedConcept ( undefined ) ) . toBeFalsy ( ) ;
45
25
} ) ;
46
-
47
- function useRootNode ( nodeData : object ) {
48
- const { loadModelsFromJson } = org . modelix . model . client2 ;
49
- return loadModelsFromJson (
50
- [ JSON . stringify ( nodeData ) ] ,
51
- // for the purpose of the test a change handler is not needed
52
- ( ) => { }
53
- ) ;
54
- }
0 commit comments