-
Notifications
You must be signed in to change notification settings - Fork 60
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: mock SDK in component tests (#56)
- Loading branch information
Showing
19 changed files
with
68 additions
and
39 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
import { | ||
createMockSiteWiseSDK, | ||
createAssetResponse, | ||
createAssetModelResponse, | ||
ASSET_PROPERTY_VALUE_HISTORY, | ||
} from '@iot-app-kit/core'; | ||
|
||
const PROPERTY_ID = 'some-property-id'; | ||
const ASSET_MODEL_ID = 'some-asset-model-id'; | ||
const PROPERTY_NAME = 'some-property-name'; | ||
|
||
const getAssetPropertyValueHistory = jest.fn().mockResolvedValue(ASSET_PROPERTY_VALUE_HISTORY); | ||
const describeAsset = jest | ||
.fn() | ||
.mockImplementation(({ assetId }) => | ||
Promise.resolve(createAssetResponse({ assetId: assetId as string, assetModelId: ASSET_MODEL_ID })) | ||
); | ||
const describeAssetModel = jest.fn().mockImplementation(({ assetModelId }) => | ||
Promise.resolve( | ||
createAssetModelResponse({ | ||
assetModelId: assetModelId as string, | ||
propertyId: PROPERTY_ID, | ||
propertyName: PROPERTY_NAME, | ||
}) | ||
) | ||
); | ||
|
||
export const mockSiteWiseSDK = createMockSiteWiseSDK({ | ||
describeAsset, | ||
describeAssetModel, | ||
getAssetPropertyValueHistory, | ||
}); |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,7 @@ | ||
export * from './data-module/index'; | ||
export * from './asset-modules/index'; | ||
export * from './iotAppKit'; | ||
export * from './iotsitewise/__mocks__/iotsitewiseSDK'; | ||
export * from './module-namespace'; | ||
export * from './query-namespace'; | ||
export * from './iotsitewise/time-series-data/provider'; | ||
export * from './testing'; // @todo: build as a separate bundle |
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
File renamed without changes.
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,6 @@ | ||
export * from './asset'; | ||
export * from './assetModel'; | ||
export * from './assetPropertyValue'; | ||
export * from './iotsitewiseSDK'; | ||
export * from './mockWidgetProperties'; | ||
export * from './data-source'; |
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 |
---|---|---|
@@ -1 +1 @@ | ||
export * from './wait'; | ||
export * from '../iotsitewise/__mocks__'; |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.