forked from Ivasoft/mattermost-mobile
* Fix for LHS populating you next to current user * Add test cases * Refactor to use avaiable props conditions in component instead of passing flags from connector
74 lines
1.6 KiB
JavaScript
74 lines
1.6 KiB
JavaScript
// Copyright (c) 2015-present Mattermost, Inc. All Rights Reserved.
|
|
// See LICENSE.txt for license information.
|
|
|
|
import {configure} from 'enzyme';
|
|
import Adapter from 'enzyme-adapter-react-16';
|
|
configure({adapter: new Adapter()});
|
|
|
|
/* eslint-disable no-console */
|
|
|
|
jest.mock('NativeModules', () => {
|
|
return {
|
|
BlurAppScreen: () => true,
|
|
MattermostManaged: {
|
|
getConfig: jest.fn(),
|
|
},
|
|
};
|
|
});
|
|
jest.mock('NativeEventEmitter');
|
|
|
|
let logs;
|
|
let warns;
|
|
let errors;
|
|
beforeAll(() => {
|
|
console.originalLog = console.log;
|
|
console.log = jest.fn((...params) => {
|
|
console.originalLog(...params);
|
|
logs.push(params);
|
|
});
|
|
|
|
console.originalWarn = console.warn;
|
|
console.warn = jest.fn((...params) => {
|
|
console.originalWarn(...params);
|
|
warns.push(params);
|
|
});
|
|
|
|
console.originalError = console.error;
|
|
console.error = jest.fn((...params) => {
|
|
console.originalError(...params);
|
|
errors.push(params);
|
|
});
|
|
});
|
|
|
|
beforeEach(() => {
|
|
logs = [];
|
|
warns = [];
|
|
errors = [];
|
|
});
|
|
|
|
afterEach(() => {
|
|
if (logs.length > 0 || warns.length > 0 || errors.length > 0) {
|
|
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(),
|
|
},
|
|
}));
|
|
|
|
global.requestAnimationFrame = (callback) => {
|
|
setTimeout(callback, 0);
|
|
};
|