From 0c563609ee2f4ca372af47bb5d63b5e1fe15bddc Mon Sep 17 00:00:00 2001 From: Ian Krieger Date: Thu, 28 Sep 2023 15:35:40 -0400 Subject: [PATCH] test: make sure adsets are ordered --- src/user/library/index.test.ts | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) diff --git a/src/user/library/index.test.ts b/src/user/library/index.test.ts index 04f7a1de..2b6522a6 100644 --- a/src/user/library/index.test.ts +++ b/src/user/library/index.test.ts @@ -385,7 +385,13 @@ describe("edit form tests", () => { ); it("should result in a valid campaign form", () => { const omitted = _.omit(editForm, ["newCreative"]); - expect(omitted).toMatchInlineSnapshot(` + const sorted = { + ...omitted, + adSets: omitted.adSets?.sort( + (a, b) => a.id?.localeCompare(b.id ?? "") ?? 1, + ), + }; + expect(sorted).toMatchInlineSnapshot(` { "adSets": [ { @@ -528,7 +534,13 @@ describe("edit form tests", () => { it("should resolve to update input", () => { const update = transformEditForm(editForm, editForm.id ?? ""); - expect(update).toMatchInlineSnapshot(` + const sorted = { + ...update, + adSets: update.adSets?.sort( + (a, b) => a.id?.localeCompare(b.id ?? "") ?? 1, + ), + }; + expect(sorted).toMatchInlineSnapshot(` { "adSets": [ {