slate-test-utils
Version:
> 📣 Love Slate and looking for your next gig? Sirona Medical is [hiring](https://sironamedical.com/about-us/careers/)!
33 lines (32 loc) • 966 B
JavaScript
// @noflow
import { clear as clearUserAgent, mockUserAgent } from 'jest-useragent-mock';
import { mockPlatform, clear as clearPlatform } from './mocks';
export const testRunner = (testCases, { runMac = true, runWindows = true } = {}) => {
if (runMac) {
describe('Mac', () => {
beforeAll(() => {
mockUserAgent('Mac OS X');
mockPlatform('Mac');
});
afterAll(() => {
clearUserAgent();
clearPlatform();
});
testCases();
});
}
if (runWindows) {
describe('Windows', () => {
beforeAll(() => {
// Windows is !IS_APPLE under the hood for Slate
mockUserAgent('');
mockPlatform('');
});
afterAll(() => {
clearUserAgent();
clearPlatform();
});
testCases();
});
}
};