import { CogniteWellsClient } from "src"; import { setupLoggedInClient } from "../testUtils"; import { expectContainAll } from "./utils/expectContainAll"; let client: CogniteWellsClient; beforeAll(async () => { client = await setupLoggedInClient(); }); test("get list of nds events", async () => { expect(client).not.toBe(undefined); const ndsEvents = await client.nds.list({}); const actual = ndsEvents.items.map((nds) => nds.source.eventExternalId); expectContainAll(actual, ["in_well1-A", "in_well1-D"]); const actualWellmatchIds = ndsEvents.items.map( (nds) => nds.wellboreMatchingId ); expect(actualWellmatchIds).not.toContain(""); }); test("filter nds events by hole top", async () => { expect(client).not.toBe(undefined); const ndsEvents = await client.nds.list({ filter: { topMeasuredDepth: { min: 5.0, max: 15.0, unit: "meter" } }, }); const actual = ndsEvents.items.map((nds) => nds.source.eventExternalId); expect(actual).toContain("in_well1-A"); expect(actual).not.toContain("in_well1-D"); }); test("filter nds events by holestart deprecated", async () => { expect(client).not.toBe(undefined); const ndsEvents = await client.nds.list({ filter: { topMeasuredDepth: { min: 5.0, max: 15.0, unit: "meter" } }, }); const actual = ndsEvents.items.map((nds) => nds.source.eventExternalId); expect(actual).toContain("in_well1-A"); expect(actual).not.toContain("in_well1-D"); }); test("aggregate nds events", async () => { expect(client).not.toBe(undefined); const aggregates = await client.nds.aggregate({ filter: { wellboreIds: [{ matchingId: "13/10-F-11 T2" }], }, groupBy: ["severity"], }); expect(aggregates.items.length).toBe(1); const aggregate = aggregates.items[0]; expect(aggregate.wellboreMatchingId).toBe("13/10-F-11 T2"); });