Skip to content

Commit

Permalink
Remove redundant semicolons in analytics-event.spec.ts
Browse files Browse the repository at this point in the history
  • Loading branch information
ludeknovy committed Sep 27, 2024
1 parent 6220cd8 commit 80a917e
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/server/utils/analytics/analytics-event.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ import { analytics } from "../analytics"

jest.mock("../analytics")


describe("AnalyticEvents", () => {

beforeEach(() => {
Expand Down Expand Up @@ -38,7 +37,7 @@ describe("AnalyticEvents", () => {
})
it("should track the event only when analytics enabled", async function () {
process.env.OPT_OUT_ANALYTICS = "false"
jest.spyOn(AnalyticsEvent as any, "getInstanceId").mockResolvedValueOnce("mocked-id");
jest.spyOn(AnalyticsEvent as any, "getInstanceId").mockResolvedValueOnce("mocked-id")
const trackMock = (analytics.track as any).mockResolvedValueOnce(undefined)
await AnalyticsEvent.reportProcessingFinished()
expect(trackMock).toHaveBeenCalled()
Expand All @@ -48,15 +47,15 @@ describe("AnalyticEvents", () => {
describe("reportLabelCount", () => {
it("should not track the event when analytics disabled", async function () {
process.env.OPT_OUT_ANALYTICS = "true"
jest.spyOn(AnalyticsEvent as any, "getInstanceId").mockResolvedValueOnce("mocked-id");
jest.spyOn(AnalyticsEvent as any, "getInstanceId").mockResolvedValueOnce("mocked-id")
const trackMock = (analytics.track as any).mockResolvedValueOnce(undefined)
await AnalyticsEvent.reportDetails(1, 1)
expect(trackMock).not.toHaveBeenCalled()

})
it("should track the event only when analytics enabled", async function () {
process.env.OPT_OUT_ANALYTICS = "false"
jest.spyOn(AnalyticsEvent as any, "getInstanceId").mockResolvedValueOnce("mocked-id");
jest.spyOn(AnalyticsEvent as any, "getInstanceId").mockResolvedValueOnce("mocked-id")
const trackMock = (analytics.track as any).mockResolvedValueOnce(undefined)
await AnalyticsEvent.reportDetails(1, 1)
expect(trackMock).toHaveBeenCalled()
Expand All @@ -66,15 +65,15 @@ describe("AnalyticEvents", () => {
describe("reportProcessingStarted", () => {
it("should not track the event when analytics disabled", async function () {
process.env.OPT_OUT_ANALYTICS = "true"
jest.spyOn(AnalyticsEvent as any, "getInstanceId").mockResolvedValueOnce("mocked-id");
jest.spyOn(AnalyticsEvent as any, "getInstanceId").mockResolvedValueOnce("mocked-id")
const trackMock = (analytics.track as any).mockResolvedValueOnce(undefined)
await AnalyticsEvent.reportProcessingStarted()
expect(trackMock).not.toHaveBeenCalled()

})
it("should track the event only when analytics enabled", async function () {
process.env.OPT_OUT_ANALYTICS = "false"
jest.spyOn(AnalyticsEvent as any, "getInstanceId").mockResolvedValueOnce("mocked-id");
jest.spyOn(AnalyticsEvent as any, "getInstanceId").mockResolvedValueOnce("mocked-id")
const trackMock = (analytics.track as any).mockResolvedValueOnce(undefined)
await AnalyticsEvent.reportProcessingStarted()
expect(trackMock).toHaveBeenCalled()
Expand All @@ -83,19 +82,18 @@ describe("AnalyticEvents", () => {
describe("unexpectedError", () => {
it("should not track the event when analytics disabled", async function () {
process.env.OPT_OUT_ANALYTICS = "true"
jest.spyOn(AnalyticsEvent as any, "getInstanceId").mockResolvedValueOnce("mocked-id");
jest.spyOn(AnalyticsEvent as any, "getInstanceId").mockResolvedValueOnce("mocked-id")
const trackMock = (analytics.track as any).mockResolvedValueOnce(undefined)
await AnalyticsEvent.reportUnexpectedError(Error("test"))
expect(trackMock).not.toHaveBeenCalled()

})
it("should track the event only when analytics enabled", async function () {
process.env.OPT_OUT_ANALYTICS = "false"
jest.spyOn(AnalyticsEvent as any, "getInstanceId").mockResolvedValueOnce("mocked-id");
jest.spyOn(AnalyticsEvent as any, "getInstanceId").mockResolvedValueOnce("mocked-id")
const trackMock = (analytics.track as any).mockResolvedValueOnce(undefined)
await AnalyticsEvent.reportUnexpectedError(Error("test"))
expect(trackMock).toHaveBeenCalled()
})
})

})

0 comments on commit 80a917e

Please sign in to comment.