Skip to content

Commit

Permalink
[backend] fix tests (#7944)
Browse files Browse the repository at this point in the history
  • Loading branch information
Archidoit committed Nov 19, 2024
1 parent 70dc0c8 commit c1d5e87
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -49,13 +49,11 @@ export const addAllowedMarkingDefinition = async (context, user, markingDefiniti
);
// add marking in max shareable markings
const groupsWithShareableMarkingToUpdate = groupsWithAutoNewMarking
.filter((g) => !g.max_shareable_markings
.find((m) => m.definition_type === markingType && m.x_opencti_order > element.x_opencti_order));
.filter((g) => !(g.max_shareable_markings ?? []).find((m) => m.definition_type === markingType && m.x_opencti_order > element.x_opencti_order));
await Promise.all(
groupsWithShareableMarkingToUpdate.map((group) => {
const currentMarkings = group.max_shareable_markings;
const finalMarkings = [
...currentMarkings.filter(({ type: t }) => t !== markingType),
...(group.max_shareable_markings ?? []).filter(({ type: t }) => t !== markingType),
...[{ type: markingType, value: markingId }],
];
return groupEditField(context, SYSTEM_USER, group.id, [{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ describe('Raw streams tests', () => {
expect(updateEventsByTypes['threat-actor'].length).toBe(17);
expect(updateEventsByTypes['vocabulary'].length).toBe(3);
expect(updateEventsByTypes['vulnerability'].length).toBe(3);
expect(updateEvents.length).toBe(174);
expect(updateEvents.length).toBe(175);
for (let updateIndex = 0; updateIndex < updateEvents.length; updateIndex += 1) {
const event = updateEvents[updateIndex];
const { data: insideData, origin, type } = event;
Expand Down

0 comments on commit c1d5e87

Please sign in to comment.