Use axios params on GET rather than string concat

This commit is contained in:
simojenki
2021-03-01 18:02:39 +11:00
parent 333c9eace9
commit cedd31d8a5
3 changed files with 37 additions and 19 deletions

View File

@@ -22,7 +22,7 @@ describe("InMemoryMusicService", () => {
expect(musicLibrary).toBeDefined();
});
it.only("should fail with an exception if an invalid token is used", async () => {
it("should fail with an exception if an invalid token is used", async () => {
const credentials = { username: "bob", password: "smith" };
service.hasUser(credentials);

View File

@@ -51,10 +51,16 @@ describe("navidrome", () => {
expect(token.userId).toEqual(username);
expect(axios.get).toHaveBeenCalledWith(
`${url}/rest/ping.view?u=${username}&t=${t(
password,
salt
)}&s=${salt}&v=1.16.1.0&c=bonob`
`${url}/rest/ping.view`,
{
params: {
u: username,
t: t(password, salt),
s: salt,
v: "1.16.1",
c: "bonob",
},
}
);
});
});
@@ -68,7 +74,9 @@ describe("navidrome", () => {
</subsonic-response>`,
});
return expect(navidrome.generateToken({ username, password })).rejects.toMatch("Wrong username or password");
return expect(
navidrome.generateToken({ username, password })
).rejects.toMatch("Wrong username or password");
});
});
});