import { CogniteWellsClient, WellSource, WellboreSource } from "../../../src"; import { setupLoggedInClient } from "../testUtils"; let client: CogniteWellsClient; beforeAll(async () => { client = await setupLoggedInClient(); }); test("ingest source", async () => { expect(client).not.toBe(undefined); const sources = await client.sources.list(); const actual = sources.items.map((source) => source.name); const expected = ["VOLVE", "EDM"]; expected.forEach((source) => expect(actual).toContain(source)); }); test("ingest and delete well and source", async () => { const wm = new CogniteWellsClient({ appId: "test", baseUrl: "http://localhost:8080", }); wm.loginWithApiKey({ apiKey: "test", project: "ingest-and-delete-well-and-source", }); await wm.sources.ingest([{ name: "NEW_SOURCE" }]); await wm.wells.mergeRules.set(["NEW_SOURCE"]); await wm.wellbores.mergeRules.set(["NEW_SOURCE"]); const wellSources: WellSource[] = [ { name: "hello", source: { assetExternalId: "hello", sourceName: "NEW_SOURCE" }, wellhead: { x: 0, y: 0, crs: "EPSG:4326" }, }, ]; await wm.wells.ingest(wellSources); const wellboreItems: WellboreSource[] = [ { name: "hello", source: { assetExternalId: "hello", sourceName: "NEW_SOURCE" }, wellAssetExternalId: "hello", }, ]; await wm.wellbores.ingest(wellboreItems); await wm.wells.delete({ items: [{ assetExternalId: "hello", sourceName: "NEW_SOURCE" }], recursive: true, }); await wm.sources.delete({ items: [{ name: "NEW_SOURCE" }], }); });