From a1b4423d22157a28bcf09d585961fb42641ea7fa Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C5=81ukasz=20Mierzwa?= Date: Wed, 24 Oct 2018 20:16:00 +0100 Subject: [PATCH] fix(tests): use partial matching when testing raven parameters .toHaveBeenCalledWith({}) uses strict equality test, entired passed object must match, we only care about dsn and release arguments so only fail if those are missing or mismatched --- ui/src/AppBoot.test.js | 20 ++++++++++++-------- 1 file changed, 12 insertions(+), 8 deletions(-) diff --git a/ui/src/AppBoot.test.js b/ui/src/AppBoot.test.js index b8f22376c..ae7052af7 100644 --- a/ui/src/AppBoot.test.js +++ b/ui/src/AppBoot.test.js @@ -71,19 +71,23 @@ describe("SetupSentry()", () => { it("configures Sentry when DSN is present", () => { const sentrySpy = jest.spyOn(Sentry, "init"); SentryClient(FakeDSN); - expect(sentrySpy).toHaveBeenCalledWith({ - dsn: FakeDSN, - release: "unknown" // default version - }); + expect(sentrySpy).toHaveBeenCalledWith( + expect.objectContaining({ + dsn: FakeDSN, + release: "unknown" // default version + }) + ); }); it("passes release option when version attr is present", () => { const sentrySpy = jest.spyOn(Sentry, "init"); SentryClient(FakeDSN, "ver1"); - expect(sentrySpy).toHaveBeenCalledWith({ - dsn: FakeDSN, - release: "ver1" - }); + expect(sentrySpy).toHaveBeenCalledWith( + expect.objectContaining({ + dsn: FakeDSN, + release: "ver1" + }) + ); }); it("logs an error when invalid DSN is passed to Sentry", () => {