import { expect } from "chai" ; import { IModelConnection } from "@itwin/core-frontend" ; import { ECSchemaRpcInterface } from "@itwin/ecschema-rpcinterface-common" ; import { TestContext } from "./setup/TestContext" ; import { SchemaKey , SchemaKeyProps , SchemaProps } from "@itwin/ecschema-metadata" ; describe ( "Schema RPC Interface" , ( ) => { let iModel ; let testContext ; before ( async ( ) => { testContext = await TestContext . instance ( ) ; iModel = await testContext . iModelWithChangesets ! . getConnection ( ) ; } ) ; it ( "should get schema keys" , async ( ) => { const schemaKeys = [ ] ; const props = await ECSchemaRpcInterface . getClient ( ) . getSchemaKeys ( iModel . getRpcProps ( ) ) ; props . forEach ( ( prop ) => schemaKeys . push ( SchemaKey . fromJSON ( prop ) ) ) ; expect ( schemaKeys ) . to . not . be . undefined ; } ) ; it ( "should get schema JSON" , async ( ) => { const schemaKeys = [ ] ; const props = await ECSchemaRpcInterface . getClient ( ) . getSchemaKeys ( iModel . getRpcProps ( ) ) ; props . forEach ( ( prop ) => schemaKeys . push ( SchemaKey . fromJSON ( prop ) ) ) ; const schemaJSON = await ECSchemaRpcInterface . getClient ( ) . getSchemaJSON ( iModel . getRpcProps ( ) , schemaKeys [ 0 ] . name ) ; expect ( schemaJSON ) . to . not . be . undefined ; } ) ; } ) ;