Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[No QA][TS migration] Migrate '__mocks__' lib to TypeScript #27011

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 0 additions & 9 deletions src/libs/__mocks__/Log.js

This file was deleted.

9 changes: 9 additions & 0 deletions src/libs/__mocks__/Log.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
// Set up manual mocks for any Logging methods that are supposed hit the 'server',
// this is needed because before, the Logging queue would get flushed while tests were running,
// causing unexpected calls to HttpUtils.xhr() which would cause mock mismatches and flaky tests.
export default {
info: (message: string) => console.debug(`[info] ${message} (mocked)`),
alert: (message: string) => console.debug(`[alert] ${message} (mocked)`),
warn: (message: string) => console.debug(`[warn] ${message} (mocked)`),
hmmm: (message: string) => console.debug(`[hmmm] ${message} (mocked)`),
};
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import _ from 'underscore';
import CONST from '../../CONST';

/**
Expand All @@ -10,8 +9,8 @@ import CONST from '../../CONST';

export default {
...jest.requireActual('../Permissions'),
canUseDefaultRooms: (betas) => _.contains(betas, CONST.BETAS.DEFAULT_ROOMS),
canUsePolicyRooms: (betas) => _.contains(betas, CONST.BETAS.POLICY_ROOMS),
canUseIOUSend: (betas) => _.contains(betas, CONST.BETAS.IOU_SEND),
canUseCustomStatus: (betas) => _.contains(betas, CONST.BETAS.CUSTOM_STATUS),
canUseDefaultRooms: (betas: string[]) => betas.includes(CONST.BETAS.DEFAULT_ROOMS),
canUsePolicyRooms: (betas: string[]) => betas.includes(CONST.BETAS.POLICY_ROOMS),
canUseIOUSend: (betas: string[]) => betas.includes(CONST.BETAS.IOU_SEND),
canUseCustomStatus: (betas: string[]) => betas.includes(CONST.BETAS.CUSTOM_STATUS),
};
Loading