mirror of
https://github.com/zoriya/react-native-web.git
synced 2026-05-26 07:49:18 +00:00
[fix] Use of process.env.NODE_ENV
Corrects misspelling in a few locations and adds tests for the Platform module. Close #2006
This commit is contained in:
committed by
Nicolas Gallagher
parent
5726d83544
commit
e826485622
@@ -22,7 +22,7 @@ export function hasPointerEvent() {
|
||||
export function setPointerEvent(bool) {
|
||||
const pointerCaptureFn = (name) => (id) => {
|
||||
if (typeof id !== 'number') {
|
||||
if (process.env.NODE_DEV !== 'production') {
|
||||
if (process.env.NODE_ENV !== 'production') {
|
||||
console.error('A pointerId must be passed to "%s"', name);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -14,4 +14,22 @@ describe('apis/Platform', () => {
|
||||
).toEqual('web');
|
||||
});
|
||||
});
|
||||
|
||||
describe('isTesting', () => {
|
||||
const NODE_ENV_BACKUP = process.env.NODE_ENV;
|
||||
|
||||
afterEach(() => {
|
||||
process.env.NODE_ENV = NODE_ENV_BACKUP;
|
||||
});
|
||||
|
||||
test('true when NODE_ENV is "test"', () => {
|
||||
process.env.NODE_ENV = 'test';
|
||||
expect(Platform.isTesting).toEqual(true);
|
||||
});
|
||||
|
||||
test('false when NODE_ENV is not "test"', () => {
|
||||
process.env.NODE_ENV = 'development';
|
||||
expect(Platform.isTesting).toEqual(false);
|
||||
});
|
||||
});
|
||||
});
|
||||
|
||||
+1
-1
@@ -12,7 +12,7 @@ const Platform = {
|
||||
OS: 'web',
|
||||
select: (obj: Object): any => ('web' in obj ? obj.web : obj.default),
|
||||
get isTesting(): boolean {
|
||||
if (process.env.NODE_DEV === 'test') {
|
||||
if (process.env.NODE_ENV === 'test') {
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
|
||||
Reference in New Issue
Block a user