Skip to content

Commit

Permalink
Fix comment
Browse files Browse the repository at this point in the history
  • Loading branch information
Damian Mussi authored and Damian Mussi committed Aug 13, 2024
1 parent d3c00dd commit b7a53e8
Showing 1 changed file with 6 additions and 39 deletions.
45 changes: 6 additions & 39 deletions packages/core/src/__tests__/embrace.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -136,6 +136,8 @@ jest.mock("react-native", () => ({
}));

const mockSt = "this is a fake stack trace";
const testView = "View";

const mockGenerateStackTrace = jest.fn();
jest.mock("../utils/ErrorUtil", () => ({
...jest.requireActual("../utils/ErrorUtil"),
Expand Down Expand Up @@ -188,7 +190,6 @@ describe("Logs Test", () => {
const WARNING = "warning";
const INFO = "info";
const ERROR = "error";
const testView = "View";

beforeEach(() => {
mockGenerateStackTrace.mockReturnValue(mockSt);
Expand Down Expand Up @@ -304,52 +305,18 @@ describe("Personas Tests", () => {

describe("Custom Views Tests", () => {
test("startView", async () => {
const mock = jest.fn();
jest.mock(
"react-native",
() => ({
NativeModules: {
EmbraceManager: {
startView: () => {
mock();
return false;
},
},
},
}),
{virtual: true},
);
const {startView} = require("../index");
const promiseToResolve = startView(testView);

jest.runAllTimers();
const result = await promiseToResolve;
expect(mock).toHaveBeenCalled();
expect(result).toBe(false);
await promiseToResolve;
expect(mockStartView).toHaveBeenCalledWith(testView);
});

test("endView", async () => {
const mock = jest.fn();
jest.mock(
"react-native",
() => ({
NativeModules: {
EmbraceManager: {
endView: () => {
mock();
return false;
},
},
},
}),
{virtual: true},
);
const {endView} = require("../index");
const promiseToResolve = endView(testView);
jest.runAllTimers();
const result = await promiseToResolve;
expect(mock).toHaveBeenCalled();
expect(result).toBe(false);
await promiseToResolve;
expect(mockEndView).toHaveBeenCalledWith(testView);
});
});

Expand Down

0 comments on commit b7a53e8

Please sign in to comment.