From 0302eebd26e51bc5329a7deb9bb4eedcfa8303c8 Mon Sep 17 00:00:00 2001 From: "nick.tessier" <22119573+nick4598@users.noreply.github.com> Date: Fri, 22 Nov 2024 13:21:15 -0500 Subject: [PATCH] dont run queryView tests if itwinjs core version is too old --- .../standalone/ECReferenceTypesCache.test.ts | 21 ++++++++++++------- 1 file changed, 14 insertions(+), 7 deletions(-) diff --git a/packages/transformer/src/test/standalone/ECReferenceTypesCache.test.ts b/packages/transformer/src/test/standalone/ECReferenceTypesCache.test.ts index e54d81b4..a9d335bd 100644 --- a/packages/transformer/src/test/standalone/ECReferenceTypesCache.test.ts +++ b/packages/transformer/src/test/standalone/ECReferenceTypesCache.test.ts @@ -13,6 +13,7 @@ import { KnownTestLocations as BackendTestsKnownLocations } from "../TestUtils/K import * as Semver from "semver"; import { Schema, SchemaItemType, SchemaLoader } from "@itwin/ecschema-metadata"; import * as sinon from "sinon"; +import { version as iTwinCoreBackendVersion } from "@itwin/core-backend/package.json"; describe("ECReferenceTypesCache", () => { let testIModel: SnapshotDb; @@ -190,13 +191,19 @@ describe("ECReferenceTypesCache", () => { }); it("should handle QueryView", async () => { - const thisTestRefCache = new ECReferenceTypesCache(); - const ecdbMapVersion = - emptyWithBrandNewBiscore.querySchemaVersion("ECdbMap"); - assert(ecdbMapVersion !== undefined); - assert(Semver.gte(ecdbMapVersion, "2.0.4")); - await emptyWithBrandNewBiscore.importSchemas([testSchemaPathWithQueryView]); - await thisTestRefCache.initAllSchemasInIModel(emptyWithBrandNewBiscore); + if (Semver.gte(iTwinCoreBackendVersion, "4.6.0")) { + const thisTestRefCache = new ECReferenceTypesCache(); + const ecdbMapVersion = + emptyWithBrandNewBiscore.querySchemaVersion("ECdbMap"); + assert(ecdbMapVersion !== undefined); + assert(Semver.gte(ecdbMapVersion, "2.0.4")); + await emptyWithBrandNewBiscore.importSchemas([ + testSchemaPathWithQueryView, + ]); + await thisTestRefCache.initAllSchemasInIModel(emptyWithBrandNewBiscore); + } else { + assert(true); // Pre 4.6.0 does not have QueryView support. https://www.itwinjs.org/bis/domains/ecdbmap.ecschema/#queryview + } }); it("should not init schemas of a lower or equal version", async () => {