Skip to content

Commit 5dd0258

Browse files
chore(groups): fix tests after delete controller modification
1 parent ff18da9 commit 5dd0258

3 files changed

Lines changed: 20 additions & 25 deletions

File tree

plugin/lib/modules/group/GroupsService.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -339,7 +339,7 @@ export class GroupsService extends BaseService {
339339
await this.sdk.document.mDelete(
340340
engineId,
341341
InternalCollection.GROUPS,
342-
[...childrenGroups.map((g) => g._id), _id],
342+
childrenGroups.map((g) => g._id),
343343
{ strict: true, triggerEvents: true },
344344
);
345345

plugin/tests/scenario/modules/groups/group-permissions.test.ts

Lines changed: 9 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ import {
3030
ApiGroupSearchResult,
3131
ApiGroupUpdateRequest,
3232
} from "lib/modules/group/types/GroupsApi";
33-
import { GroupContent } from "lib/modules/group/types/GroupContent";
3433

3534
describe("GroupsController", () => {
3635
const sdk = setupHooks();
@@ -188,17 +187,15 @@ describe("GroupsController", () => {
188187
_id: groupTestParentId1,
189188
});
190189

191-
const { _source: childrenGroup } = await sdk.document.get<GroupContent>(
192-
"engine-ayse",
193-
InternalCollection.GROUPS,
194-
groupTestChildrenId1,
190+
const deletedChildQuery = {
191+
controller: "device-manager/groups",
192+
action: "get",
193+
engineId: "engine-ayse",
194+
_id: groupTestChildrenId1,
195+
};
196+
await expect(sdk.query(deletedChildQuery)).rejects.toThrow(
197+
/test-children-1/,
195198
);
196-
197-
expect(childrenGroup).toMatchObject({
198-
path: groupTestChildrenId1,
199-
});
200-
expect(childrenGroup.lastUpdate).toBeGreaterThanOrEqual(now);
201-
202199
await sdk.query<ApiGroupDeleteRequest>({
203200
controller: "device-manager/groups",
204201
engineId: "engine-ayse",
@@ -212,7 +209,7 @@ describe("GroupsController", () => {
212209
"Container-grouped",
213210
);
214211

215-
expect(assetGrouped).toMatchObject({
212+
expect(assetGrouped).not.toMatchObject({
216213
groups: [
217214
{
218215
path: groupChildrenWithAssetId,

plugin/tests/scenario/modules/groups/group.test.ts

Lines changed: 10 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -385,18 +385,16 @@ describe("GroupsController", () => {
385385
action: "delete",
386386
_id: groupTestParentId1,
387387
});
388-
389-
const { _source: childrenGroup } = await sdk.document.get<GroupContent>(
390-
"engine-ayse",
391-
InternalCollection.GROUPS,
392-
groupTestChildrenId1,
388+
await sdk.collection.refresh("engine-ayse", "groups");
389+
const deletedChildQuery = {
390+
controller: "device-manager/groups",
391+
action: "get",
392+
engineId: "engine-ayse",
393+
_id: groupTestChildrenId1,
394+
};
395+
await expect(sdk.query(deletedChildQuery)).rejects.toThrow(
396+
/test-children-1/,
393397
);
394-
395-
expect(childrenGroup).toMatchObject({
396-
path: groupTestChildrenId1,
397-
});
398-
expect(childrenGroup.lastUpdate).toBeGreaterThanOrEqual(now);
399-
400398
await sdk.query<ApiGroupDeleteRequest>({
401399
controller: "device-manager/groups",
402400
engineId: "engine-ayse",
@@ -410,7 +408,7 @@ describe("GroupsController", () => {
410408
"Container-grouped",
411409
);
412410

413-
expect(assetGrouped).toMatchObject({
411+
expect(assetGrouped).not.toMatchObject({
414412
groups: [
415413
{
416414
path: groupChildrenWithAssetId,

0 commit comments

Comments
 (0)