"use strict";
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
Object.defineProperty(exports, "__esModule", { value: true });
const chai = require("chai");
const core_common_1 = require("@itwin/core-common");
const core_frontend_1 = require("@itwin/core-frontend");
const TestContext_1 = require("./setup/TestContext");
const expect = chai.expect;
describe("IModel Elements", () => {
    let iModel;
    let elements;
    before(async function () {
        const testContext = await TestContext_1.TestContext.instance();
        if (!testContext.settings.runiModelReadRpcTests)
            this.skip();
        iModel = await testContext.iModelWithChangesets.getConnection();
        elements = iModel.elements;
    });
    it("should get props", async () => {
        const elementIds = [elements.rootSubjectId];
        const elementProps = await elements.getProps(elementIds);
        expect(elementProps).to.exist.and.be.not.empty;
    });
    it("should query props", async () => {
        const elementProps = await elements.queryProps({ from: core_frontend_1.SpatialModelState.classFullName });
        expect(elementProps).to.exist.and.be.not.empty;
    });
    it("should query ids", async () => {
        const ids = await elements.queryIds({ limit: 10, from: "BisCore:Subject" });
        expect(ids).to.exist;
    });
});
describe("Operational: Execute Query", () => {
    it("should successfully execute a simple query", async function () {
        const testContext = await TestContext_1.TestContext.instance();
        if (!testContext.settings.runiModelReadRpcTests)
            this.skip();
        const iModel = await testContext.iModelWithChangesets.getConnection();
        const query = "select count(*) nRows from(SELECT ECInstanceId FROM Bis.Element LIMIT 50)";
        const rows = [];
        // eslint-disable-next-line @typescript-eslint/no-deprecated
        for await (const row of iModel.createQueryReader(query, undefined, { rowFormat: core_common_1.QueryRowFormat.UseJsPropertyNames }))
            rows.push(row);
        expect(rows).to.be.not.empty;
    });
});
//# sourceMappingURL=Elements.test.js.map