-
Notifications
You must be signed in to change notification settings - Fork 22
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(react-components): list 360-core-dm-connected assets (#4967)
* fix(react-components): list 360-core-dm-connected assets Does not include Search-capabilities * feat: enable search filtering for 360 * chore: lint fix in viewer * chore: correct AnnotationAssetRef type * chore: ignore lint error I swear, I could not for the life of me make the linter accept this. * chore: try to fix build error by upgrading target ES version in tsconfig * Revert "chore: try to fix build error by upgrading target ES version in tsconfig" This reverts commit 4b4818d. * test(react-components): Add tests for listMappedFdmNodes * chore: remove unnecessary results, improve typing * chore: tests WIP * chore: minor changes to filterNodesByMappedTo3d * chore: rename annotations-folder and utilities * chore: spurious cleanup, lint and add missing files * chore: lint fix again * chore: lint fix YET AGAIN (not sure why CI get more errors than me) * test: a few tests for CoreDm3dDataProvider * chore: move fixtures * chore: lint fix * chore: remove outdated file * chore: remove a bunch of cyclic dependencies * chore: LINT FIXSNTEOHUSNEOTHUSNTOEHUSNTH * chore: don't initialize mock * chore: import right function... * Update react-components/src/data-providers/core-dm-provider/listMappedFdmNodes.test.ts Co-authored-by: Fredrik Anfinsen <[email protected]> * Update react-components/src/utilities/image360Annotations/getImage360AnnotationAssetRef.ts Co-authored-by: Fredrik Anfinsen <[email protected]> * chore: increase type safety * chore: lint fix * chore: avoid as unknown * chore: rewrite image360 queries to make life easier for Typescript * chore: add missing export * chore: correct tests etc. * chore: lint fix * fix: persist unhoisted properties in return value from search * fix: correct table name in FDM query * chore: lint fix * fix: fix typing in hoist function --------- Co-authored-by: pramod-cog <[email protected]> Co-authored-by: Fredrik Anfinsen <[email protected]> Co-authored-by: Christopher J. Tannum <[email protected]>
- Loading branch information
1 parent
0f87583
commit 5c95b6f
Showing
52 changed files
with
1,274 additions
and
263 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
81 changes: 81 additions & 0 deletions
81
react-components/src/data-providers/core-dm-provider/CoreDm3dDataProvider.test.ts
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,81 @@ | ||
/*! | ||
* Copyright 2025 Cognite AS | ||
*/ | ||
import { describe, expect, it, beforeEach } from 'vitest'; | ||
import { CoreDm3dFdm3dDataProvider } from './CoreDm3dDataProvider'; | ||
import { Mock, It, type IMock } from 'moq.ts'; | ||
import { type FdmSDK } from '../FdmSDK'; | ||
import { restrictToDmsId } from '../../utilities/restrictToDmsId'; | ||
import { type AddImage360CollectionDatamodelsOptions } from '../../components'; | ||
import { | ||
modelInstanceFixture0, | ||
revisionInstanceFixture0 | ||
} from '../../../tests/tests-utilities/fixtures/dm/model3dData'; | ||
|
||
const image360CollectionId: AddImage360CollectionDatamodelsOptions = { | ||
externalId: 'image360Collection0', | ||
space: 'space0', | ||
source: 'cdm' | ||
}; | ||
|
||
const modelId0 = 1234; | ||
const revisionId0 = 5678; | ||
|
||
describe(CoreDm3dFdm3dDataProvider.name, () => { | ||
let fdmSdkMock: IMock<FdmSDK>; | ||
|
||
beforeEach(() => { | ||
fdmSdkMock = createFdmSdkMock(); | ||
}); | ||
|
||
it('should fetch model ref for classic input model options', async () => { | ||
const coreDmProvider = new CoreDm3dFdm3dDataProvider(fdmSdkMock.object()); | ||
|
||
const result = await coreDmProvider.getDMSModels(modelId0); | ||
|
||
expect(result).toEqual([restrictToDmsId(modelInstanceFixture0)]); | ||
}); | ||
|
||
it('should fetch revision ref for classic input model options', async () => { | ||
const coreDmProvider = new CoreDm3dFdm3dDataProvider(fdmSdkMock.object()); | ||
|
||
const result = await coreDmProvider.getRevisionRefs([ | ||
{ modelId: modelId0, revisionId: revisionId0 } | ||
]); | ||
|
||
expect(result).toEqual([restrictToDmsId(revisionInstanceFixture0)]); | ||
}); | ||
|
||
it('should return the input ID when input is CoreDM image360 options', async () => { | ||
const coreDmProvider = new CoreDm3dFdm3dDataProvider(fdmSdkMock.object()); | ||
|
||
const result = await coreDmProvider.getRevisionRefs([image360CollectionId]); | ||
|
||
expect(result).toEqual([restrictToDmsId(image360CollectionId)]); | ||
}); | ||
}); | ||
|
||
function createFdmSdkMock(): IMock<FdmSDK> { | ||
return new Mock<FdmSDK>() | ||
.setup( | ||
async (p) => | ||
await p.queryNodesAndEdges( | ||
It.Is( | ||
(query) => | ||
(query as any).with?.models?.nodes?.filter?.and?.[0]?.equals?.value === | ||
`cog_3d_model_${modelId0}` | ||
) | ||
) | ||
) | ||
.returns(Promise.resolve({ items: { models: [modelInstanceFixture0] } })) | ||
.setup( | ||
async (p) => | ||
await p.queryNodesAndEdges( | ||
It.Is( | ||
(query) => | ||
(query as any).parameters?.revisionExternalId === `cog_3d_revision_${revisionId0}` | ||
) | ||
) | ||
) | ||
.returns(Promise.resolve({ items: { revision: [revisionInstanceFixture0] } })); | ||
} |
Oops, something went wrong.