When running bonob outside of sonos network ability to register with sonos using remote bonob

This commit is contained in:
simojenki
2021-08-06 18:12:55 +10:00
parent 22b8bf76d2
commit 27dc933ee0
8 changed files with 95 additions and 40 deletions

View File

@@ -307,6 +307,36 @@ describe("server", () => {
});
});
describe("/about", () => {
const sonos = {
register: jest.fn(),
};
const theService = aService({
name: "We can all live a life of service",
sid: 999,
});
const server = makeServer(
sonos as unknown as Sonos,
theService,
bonobUrl,
new InMemoryMusicService()
);
it("should report some information about the service", async () => {
const res = await request(server)
.get(bonobUrl.append({ pathname: "/about" }).path())
.send();
expect(res.status).toEqual(200);
expect(res.body).toEqual({
service: {
name: theService.name,
sid: theService.sid
}
});
});
});
describe("/register", () => {
const sonos = {
register: jest.fn(),
@@ -322,7 +352,7 @@ describe("server", () => {
new InMemoryMusicService()
);
describe("when is succesfull", () => {
describe("when is successful", () => {
it("should return a nice message", async () => {
sonos.register.mockResolvedValue(true);
@@ -338,7 +368,7 @@ describe("server", () => {
});
});
describe("when is unsuccesfull", () => {
describe("when is unsuccessful", () => {
it("should return a failure message", async () => {
sonos.register.mockResolvedValue(false);