Change rn-fetch-blob to mock globally in jest (#2124)

This commit is contained in:
Sudheer 2018-09-14 20:44:37 +05:30 committed by Elias Nahum
parent 92218659d5
commit 5aac68e785
8 changed files with 16 additions and 75 deletions

View file

@ -11,13 +11,6 @@ import {
handlePasswordChanged,
} from 'app/actions/views/login';
jest.mock('rn-fetch-blob/fs', () => ({
dirs: {
DocumentDir: () => jest.fn(),
CacheDir: () => jest.fn(),
},
}));
jest.mock('app/mattermost', () => ({
app: {
setAppCredentials: () => jest.fn(),

View file

@ -11,13 +11,6 @@ import {ViewTypes} from 'app/constants';
import {handleServerUrlChanged} from 'app/actions/views/select_server';
jest.mock('rn-fetch-blob/fs', () => ({
dirs: {
DocumentDir: () => jest.fn(),
CacheDir: () => jest.fn(),
},
}));
const mockStore = configureStore([thunk]);
describe('Actions.Views.SelectServer', () => {

View file

@ -11,13 +11,6 @@ import {
handleCommentDraftSelectionChanged,
} from 'app/actions/views/thread';
jest.mock('rn-fetch-blob/fs', () => ({
dirs: {
DocumentDir: () => jest.fn(),
CacheDir: () => jest.fn(),
},
}));
const mockStore = configureStore([thunk]);
describe('Actions.Views.Thread', () => {

View file

@ -17,22 +17,6 @@ jest.mock('app/utils/theme', () => {
};
});
jest.mock('rn-fetch-blob', () => ({
fs: {
dirs: {
DocumentDir: () => jest.fn(),
CacheDir: () => jest.fn(),
},
},
}));
jest.mock('rn-fetch-blob/fs', () => ({
dirs: {
DocumentDir: () => jest.fn(),
CacheDir: () => jest.fn(),
},
}));
describe('UserListRow', () => {
const formatMessage = jest.fn();
const baseProps = {

View file

@ -7,22 +7,6 @@ import {RequestStatus} from 'mattermost-redux/constants';
import SelectTeam from './select_team.js';
jest.mock('rn-fetch-blob', () => ({
fs: {
dirs: {
DocumentDir: () => jest.fn(),
CacheDir: () => jest.fn(),
},
},
}));
jest.mock('rn-fetch-blob/fs', () => ({
dirs: {
DocumentDir: () => jest.fn(),
CacheDir: () => jest.fn(),
},
}));
jest.mock('app/utils/theme', () => {
const original = require.requireActual('app/utils/theme');
return {

View file

@ -5,21 +5,6 @@ import {shallow} from 'enzyme';
jest.mock('react-intl');
import UserProfile from './user_profile.js';
jest.mock('rn-fetch-blob', () => ({
fs: {
dirs: {
DocumentDir: () => jest.fn(),
CacheDir: () => jest.fn(),
},
},
}));
jest.mock('rn-fetch-blob/fs', () => ({
dirs: {
DocumentDir: () => jest.fn(),
CacheDir: () => jest.fn(),
},
}));
jest.mock('app/utils/theme', () => {
const original = require.requireActual('app/utils/theme');

View file

@ -8,13 +8,6 @@ import assert from 'assert';
import {ViewTypes} from 'app/constants';
import {messageRetention} from 'app/store/middleware';
jest.mock('rn-fetch-blob/fs', () => ({
dirs: {
DocumentDir: () => jest.fn(),
CacheDir: () => jest.fn(),
},
}));
jest.mock('react-native-device-info', () => {
return {
getVersion: () => '0.0.0',

View file

@ -41,3 +41,19 @@ afterEach(() => {
throw new Error('Unexpected console logs' + logs + warns + errors);
}
});
jest.mock('rn-fetch-blob', () => ({
fs: {
dirs: {
DocumentDir: () => jest.fn(),
CacheDir: () => jest.fn(),
},
},
}));
jest.mock('rn-fetch-blob/fs', () => ({
dirs: {
DocumentDir: () => jest.fn(),
CacheDir: () => jest.fn(),
},
}));