import * as chai from "chai" ; import "url-search-params-polyfill" ; import { MindSphereSdk } from "../src" ; import { decrypt , loadAuth } from "../src/api/utils" ; import { setupDeviceTestStructure , tearDownDeviceTestStructure } from "./test-device-setup-utils" ; import { getPasskeyForUnitTest } from "./test-utils" ; chai . should ( ) ; describe ( "[SDK] DeviceManagementClient.Status" , ( ) => { const auth = loadAuth ( ) ; const sdk = new MindSphereSdk ( { ... auth , basicAuth : decrypt ( auth , getPasskeyForUnitTest ( ) ) , } ) ; const deviceStatusManagement = sdk . GetDeviceStatusManagementClient ( ) ; const tenant = sdk . GetTenant ( ) ; let deviceTypeId = "aee2e37f-f562-4ed6-b90a-c43208dc054a" ; let assetTypeId = `${ tenant }.UnitTestDeviceAssetType` ; let assetId = "" ; let deviceId = "" ; let gFolderid = "" ; before ( async ( ) => { const { device , deviceAsset , deviceType , deviceAssetType , folderid } = await setupDeviceTestStructure ( sdk ) ; assetTypeId = `${ ( deviceAssetType as any ) . id }` ; deviceTypeId = `${ ( deviceType as any ) . id }` ; assetId = `${ ( deviceAsset as any ) . assetId }` ; deviceId = `${ ( device as any ) . id }` ; gFolderid = `${ folderid }` ; } ) ; after ( async ( ) => { await tearDownDeviceTestStructure ( sdk ) ; } ) ; it ( "SDK should not be undefined" , async ( ) => { sdk . should . not . be . undefined ; } ) ; it ( "standard properties should be defined" , async ( ) => { deviceStatusManagement . should . not . be . undefined ; deviceStatusManagement . GetGateway ( ) . should . be . equal ( auth . gateway ) ; ( await deviceStatusManagement . GetToken ( ) ) . length . should . be . greaterThan ( 200 ) ; ( await deviceStatusManagement . GetToken ( ) ) . length . should . be . greaterThan ( 200 ) ; } ) ; it ( "should GET list software installed on device" , async ( ) => { deviceStatusManagement . should . not . be . undefined ; const softwareList = await deviceStatusManagement . GetDeviceSoftwares ( `${ deviceId }` ) ; softwareList . should . not . be . undefined ; softwareList . should . not . be . null ; ( softwareList as any ) . content . length . should . be . gte ( 0 ) ; } ) ; } ) ;