import { isPlainObject } from "lodash" ; import { expect } from "chai" ; import { UI5SemanticModel } from "@ui5-language-assistant/semantic-model-types" ; import { forEachSymbol } from "../../src/api" ; export function isObject ( value ) { return isPlainObject ( value ) ; } export function getFQN ( model , target ) { let fqn = undefined ; forEachSymbol ( model , ( symbol , name ) => { if ( symbol === target ) { fqn = name ; return false ; } return undefined ; } ) ; return fqn ; } export function expectModelObjectsEqual ( model , value , expectedValue , message ) { const result = value === expectedValue ; if ( ! result ) { const valueName = getFQN ( model , value ) ?? ( value as { name : string ; } ) . name ; const expectedName = getFQN ( model , expectedValue ) ?? ( expectedValue as { name : string ; } ) . name ; message = `${ message }: got ${ valueName } instead of ${ expectedName }` ; } expect ( result , message ) . to . be . true ; }