The channel list resource, /ISAPI/ContentMgmt/InputProxy/channels.
The channels come in document order; a channel without a source descriptor
has only id and name.
Read through a stubbed fetch
Read through a stubbed fetch
import { assertEquals } from "@std/assert"; import { resolvesNext, spy } from "@std/testing/mock"; import { request } from "../request.ts"; import { inputProxyChannels } from "./input-proxy-channels.ts"; const fetch = spy(resolvesNext([ new Response( "<InputProxyChannelList><InputProxyChannel><id>2</id><name>Camera 02</name>" + "</InputProxyChannel></InputProxyChannelList>", ), ])); const channels = await request({ baseUrl: "http://192.0.2.10", username: "admin", password: "hunter2", fetch, }, inputProxyChannels); assertEquals(channels, [{ id: 2, name: "Camera 02" }]); assertEquals(fetch.calls[0].args[0], "http://192.0.2.10/ISAPI/ContentMgmt/InputProxy/channels");