1- import { org } from "@modelix/model-client" ;
2- import { LanguageRegistry } from "@modelix/ts-model-api" ;
31import {
42 isOfConcept_INamedConcept ,
53 isOfConcept_PropertyAttribute ,
64 isOfConcept_Attribute ,
75} from "../build/typescript_src/L_jetbrains_mps_lang_core" ;
8- import { registerLanguages } from "../build/typescript_src " ;
6+ import { useFakeNode } from "./test-helpers " ;
97
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 ( ) ;
299
3010test ( "verifies the concept of a node" , ( ) => {
3111 expect ( isOfConcept_PropertyAttribute ( typedNode ) ) . toBeTruthy ( ) ;
@@ -43,12 +23,3 @@ test("nullish values are never of the type of the checked concept", () => {
4323 expect ( isOfConcept_INamedConcept ( null ) ) . toBeFalsy ( ) ;
4424 expect ( isOfConcept_INamedConcept ( undefined ) ) . toBeFalsy ( ) ;
4525} ) ;
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