mirror of
https://github.com/zhom/donutbrowser.git
synced 2026-08-17 16:37:20 +02:00
test: integration cleanup
This commit is contained in:
@@ -567,8 +567,24 @@ test("authenticated REST API serves its complete OpenAPI contract and CRUD lifec
|
|||||||
);
|
);
|
||||||
assert.equal(assigned.response.status, 200, JSON.stringify(assigned.value));
|
assert.equal(assigned.response.status, 200, JSON.stringify(assigned.value));
|
||||||
assert.equal(assigned.value.profile.id, launchProfile.id);
|
assert.equal(assigned.value.profile.id, launchProfile.id);
|
||||||
// `ApiProfile` carries no `extension_group_id`, so the assignment can only
|
// A caller that can set the assignment must be able to read it back without
|
||||||
// be read back through the surface the launcher itself resolves.
|
// dropping to the desktop app.
|
||||||
|
assert.equal(
|
||||||
|
assigned.value.profile.extension_group_id,
|
||||||
|
launchGroupId,
|
||||||
|
"the update response must echo the assignment it just made",
|
||||||
|
);
|
||||||
|
assert.equal(
|
||||||
|
(
|
||||||
|
await jsonRequest(`${base}/v1/profiles/${launchProfile.id}`, {
|
||||||
|
token: saved.api_token,
|
||||||
|
})
|
||||||
|
).value.profile.extension_group_id,
|
||||||
|
launchGroupId,
|
||||||
|
"a fresh GET must report the assignment",
|
||||||
|
);
|
||||||
|
// Also read it back through the surface the launcher itself resolves, so
|
||||||
|
// the REST field and the launch path cannot drift apart.
|
||||||
const assignedGroup = () =>
|
const assignedGroup = () =>
|
||||||
app.invoke("get_extension_group_for_profile", {
|
app.invoke("get_extension_group_for_profile", {
|
||||||
profileId: launchProfile.id,
|
profileId: launchProfile.id,
|
||||||
@@ -610,6 +626,15 @@ test("authenticated REST API serves its complete OpenAPI contract and CRUD lifec
|
|||||||
200,
|
200,
|
||||||
);
|
);
|
||||||
assert.equal(await assignedGroup(), null);
|
assert.equal(await assignedGroup(), null);
|
||||||
|
assert.equal(
|
||||||
|
(
|
||||||
|
await jsonRequest(`${base}/v1/profiles/${launchProfile.id}`, {
|
||||||
|
token: saved.api_token,
|
||||||
|
})
|
||||||
|
).value.profile.extension_group_id,
|
||||||
|
null,
|
||||||
|
"clearing the assignment must be visible over REST too",
|
||||||
|
);
|
||||||
assert.equal(
|
assert.equal(
|
||||||
(
|
(
|
||||||
await jsonRequest(`${base}/v1/extension-groups/${launchGroupId}`, {
|
await jsonRequest(`${base}/v1/extension-groups/${launchGroupId}`, {
|
||||||
|
|||||||
Reference in New Issue
Block a user