/**
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 *
 */

import { statement } from '../../../tests/utils';
import getMemberExpressionValuePath from '../getMemberExpressionValuePath';

describe('getMemberExpressionValuePath', () => {
  describe('MethodExpression', () => {
    it('finds "normal" property definitions', () => {
      const def = statement(`
        var Foo = () => {};
        Foo.propTypes = {};
      `);

      expect(getMemberExpressionValuePath(def, 'propTypes')).toBe(
        def.parent.get('body', 1, 'expression', 'right'),
      );
    });

    it('takes the correct property definitions', () => {
      const def = statement(`
        var Foo = () => {};
        Foo.propTypes = {};
        Bar.propTypes = { unrelated: true };
      `);

      expect(getMemberExpressionValuePath(def, 'propTypes')).toBe(
        def.parent.get('body', 1, 'expression', 'right'),
      );
    });

    it('finds computed property definitions with literal keys', () => {
      const def = statement(`
        function Foo () {}
        Foo['render'] = () => {};
      `);

      expect(getMemberExpressionValuePath(def, 'render')).toBe(
        def.parent.get('body', 1, 'expression', 'right'),
      );
    });

    it('ignores computed property definitions with expression', () => {
      const def = statement(`
        var Foo = function Bar() {};
        Foo[imComputed] = () => {};
      `);

      expect(getMemberExpressionValuePath(def, 'imComputed')).not.toBeDefined();
    });
  });
  describe('TaggedTemplateLiteral', () => {
    it('finds "normal" property definitions', () => {
      const def = statement(`
        var Foo = foo\`bar\`
        Foo.propTypes = {};
      `);

      expect(getMemberExpressionValuePath(def, 'propTypes')).toBe(
        def.parent.get('body', 1, 'expression', 'right'),
      );
    });
  });
  describe('CallExpression', () => {
    it('finds "normal" property definitions', () => {
      const def = statement(`
        const Foo = system({is: "button"}, "space");
        Foo.propTypes = {};
      `);

      expect(getMemberExpressionValuePath(def, 'propTypes')).toBe(
        def.parent.get('body', 1, 'expression', 'right'),
      );
    });
  });
});

@@ -204,16 +204,30 @@
 tatement
+, noopImporter
  %7D from 
@@ -250,16 +250,16 @@
 utils';%0A
-
 import g
@@ -616,32 +616,46 @@
 def, 'propTypes'
+, noopImporter
 )).toBe(%0A       
@@ -972,32 +972,46 @@
 def, 'propTypes'
+, noopImporter
 )).toBe(%0A       
@@ -1308,16 +1308,30 @@
 'render'
+, noopImporter
 )).toBe(
@@ -1652,16 +1652,30 @@
 omputed'
+, noopImporter
 )).not.t
@@ -1948,32 +1948,46 @@
 def, 'propTypes'
+, noopImporter
 )).toBe(%0A       
@@ -2265,32 +2265,32 @@
  %7B%7D;%0A      %60);%0A%0A
-
       expect(get
@@ -2331,16 +2331,30 @@
 opTypes'
+, noopImporter
 )).toBe(

Add noopImporter to getMemberExpressionValuePath tests