
import DeviceManager from '@/domain/models/DeviceManager.js'
import {DEVICE_COLLECTION,DEVICE_WITHOUT_SUBNET,DEVICE_INUSE,DEVICE_STOP_USE,NEW_DEVICE_LIST} from "../../../mock/deviceState/DeviceMock";
import {SUBNET_COLLECTION,SUBNET_COLLECTION_RESULT} from "../../../mock/deviceState/SubnetMock"

describe ('DeviceManager', () => {
  it("should findDeviceByKey", () => {

      let deviceCollection = DEVICE_COLLECTION

      let device = DeviceManager(deviceCollection)
      let dev = device.findDeviceByKey("111")
    expect(dev).to.eql(deviceCollection["111"])
  })
})

describe ('DeviceManager', () => {
  it("should getSubnetWithDeviceListAndNoDeviceList", () => {

    let subnetCollection = SUBNET_COLLECTION

    let deviceCollection = DEVICE_COLLECTION

    let subnet = SUBNET_COLLECTION_RESULT

    let device = DeviceManager(deviceCollection)
    let sub = device.getSubnetWithDeviceListAndNoDeviceList(subnetCollection)
    expect(sub).to.eql(subnet)
  })
})

describe ('DeviceManager', () => {
  it("should getDeviceListWithoutSubnet", () => {

    let deviceCollection = DEVICE_COLLECTION

    let deviceSample = DEVICE_WITHOUT_SUBNET

    let device = DeviceManager(deviceCollection)
    let dev = device.getDeviceListWithoutSubnet()
    expect(dev).to.eql(deviceSample)
  })
})


describe ('DeviceManager', () => {
  it("should getInUsDeviceList", () => {

    let deviceCollection = DEVICE_COLLECTION

    let deviceInUse = DEVICE_INUSE

    let device = DeviceManager(deviceCollection)
    let devList = device.getInUsDeviceList()

    expect(devList).to.eql(deviceInUse)
    // expect(devList["222"]).to.eql(deviceInUse["222"])
  })
})

describe ('DeviceManager', () => {
  it("should getStopUsingDeviceList", () => {

    let deviceCollection = DEVICE_COLLECTION

    let deviceStopUsing = DEVICE_STOP_USE

    let device = DeviceManager(deviceCollection)
    let devList = device.getStopUsingDeviceList()
    expect(devList).to.eql(deviceStopUsing)
  })
})

describe ('DeviceManager', () => {
  it("should createNewDeviceListWithPortNameAndKey", () => {

    let deviceCollection = DEVICE_COLLECTION

    let newDeviceList = NEW_DEVICE_LIST

    let device = DeviceManager(deviceCollection)
    let devList = device.createNewDeviceListWithPortNameAndKey()
    expect(devList).to.eql(newDeviceList)
  })
})


