mirror of
https://github.com/prymitive/karma
synced 2026-05-05 03:16:51 +00:00
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
This commit is contained in:
@@ -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", () => {
|
||||
|
||||
Reference in New Issue
Block a user