mirror of
https://github.com/status-im/metro.git
synced 2025-02-21 07:18:11 +00:00
metro: inline-plugin-test: does not replace local variables
Reviewed By: fromcelticpark Differential Revision: D7533450 fbshipit-source-id: 5f1d37ad3cd8ecd585d627edd501f732837f12c5
This commit is contained in:
parent
203bb0ddfd
commit
caf4fe379f
@ -79,6 +79,15 @@ describe('inline constants', () => {
|
||||
expect(toString(ast)).toEqual(normalize(code.replace(/__DEV__/, 'true')));
|
||||
});
|
||||
|
||||
it("doesn't replace a local __DEV__ variable", () => {
|
||||
const code = `function a() {
|
||||
var __DEV__ = false;
|
||||
var a = __DEV__ ? 1 : 2;
|
||||
}`;
|
||||
const {ast} = inline('arbitrary.js', {code}, {dev: true});
|
||||
expect(toString(ast)).toEqual(normalize(code));
|
||||
});
|
||||
|
||||
it('replaces Platform.OS in the code if Platform is a global', () => {
|
||||
const code = `function a() {
|
||||
var a = Platform.OS;
|
||||
|
Loading…
x
Reference in New Issue
Block a user