@itwin/insights-client
Version:
Insights client for the iTwin platform
58 lines • 2.57 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
/*---------------------------------------------------------------------------------------------
* Copyright (c) Bentley Systems, Incorporated. All rights reserved.
* See LICENSE.md in the project root for license terms and full copyright notice.
*--------------------------------------------------------------------------------------------*/
const chaiAsPromised = require("chai-as-promised");
const chai_1 = require("chai");
require("reflect-metadata");
const GlobalSetup_1 = require("../utils/GlobalSetup");
(0, chai_1.use)(chaiAsPromised);
describe("EC3JobsClient (report schema)", () => {
let configurationId;
let reportId;
before(async () => {
const newReport = {
displayName: "testReport",
projectId: GlobalSetup_1.iTwinId,
};
const report = await GlobalSetup_1.reportsClient.createReport(GlobalSetup_1.accessToken, newReport);
reportId = report.id;
const material = {
nameColumn: "materialName",
};
const label = {
name: "name",
reportTable: "table",
elementNameColumn: "elementName",
elementQuantityColumn: "elementQuantity",
materials: [material],
};
const newConfig = {
reportId: report.id,
displayName: "Test",
labels: [label],
};
const config = await GlobalSetup_1.configurationsClient.createConfiguration(GlobalSetup_1.accessToken, newConfig);
configurationId = config.id;
});
after(async () => {
await GlobalSetup_1.configurationsClient.deleteConfiguration(GlobalSetup_1.accessToken, configurationId);
await GlobalSetup_1.reportsClient.deleteReport(GlobalSetup_1.accessToken, reportId);
});
it("jobs - run extraction and get status", async () => {
const newJob = {
projectName: "test",
ec3BearerToken: "no token :(",
configurationId,
};
const job = await GlobalSetup_1.jobsClient.createJob(GlobalSetup_1.accessToken, newJob);
(0, chai_1.expect)(job).to.not.be.undefined;
(0, chai_1.expect)(job.id).to.not.be.undefined;
const status = await GlobalSetup_1.jobsClient.getEC3JobStatus(GlobalSetup_1.accessToken, job.id);
(0, chai_1.expect)(status).to.not.be.undefined;
(0, chai_1.expect)(["Failed", "Running", "Queued"]).to.include(status.status);
});
});
//# sourceMappingURL=EC3JobsClientReport.test.js.map