def validate_generated_config(self, config, path, translate=None, devtool=None):
        self.assertIsInstance(config['context'], JS)
        self.assertEqual(
            config['context'].content,
            'path.join.apply(path, ["' + '", "'.join(split_path(os.path.dirname(path))) + '"])'
        )

        self.assertEqual(
            config['entry'],
            './' + os.path.basename(path)
        )

        self.assertIsInstance(config['output']['path'], JS)
        self.assertEqual(
            config['output']['path'].content,
            'path.join.apply(path, ["[bundle_dir]", "components"])'
        )

        var = generate_var_from_path(path)

        self.assertEqual(
            config['output']['filename'],
            var + '-[hash].js'
        )

        self.assertEqual(
            config['output']['filename'],
            var + '-[hash].js'
        )

        self.assertEqual(
            config['output']['libraryTarget'],
            'umd'
        )

        self.assertEqual(
            config['output']['library'],
            var
        )

        self.assertEqual(config['externals'][0]['react']['commonjs2'], 'react',)
        self.assertEqual(config['externals'][0]['react']['root'], 'React')

        self.assertEqual(config['externals'][0]['react/addons']['commonjs2'], 'react')
        self.assertEqual(config['externals'][0]['react/addons']['root'], 'React')

        if devtool:
            self.assertEqual(config['devtool'], devtool)

        if translate:
            self.assertIsInstance(config['module']['loaders'][0]['test'], JS)
            self.assertEqual(config['module']['loaders'][0]['test'].content, '/.jsx?$/')

            self.assertIsInstance(config['module']['loaders'][0]['exclude'], JS)
            self.assertEqual(config['module']['loaders'][0]['exclude'].content, '/node_modules/')

            self.assertEqual(config['module']['loaders'][0]['loader'], 'babel-loader')

            node_modules = os.path.join(TEST_ROOT, 'node_modules')
            self.assertIsInstance(config['resolveLoader']['root'], JS)
            self.assertEqual(
                config['resolveLoader']['root'].content,
                'path.join.apply(path, ["' + '", "'.join(split_path(node_modules)) + '"])',
            )
 def test_can_generate_a_var_from_a_path(self):
     self.assertEqual(generate_var_from_path('/foo/bar/woz.jsx'), 'bar__woz')
     self.assertEqual(generate_var_from_path('/foo-bar/woz.jsx'), 'foo_bar__woz')
     self.assertEqual(generate_var_from_path('/foo/ba +\\r/woz.jsx'), 'ba_r__woz')
     self.assertEqual(generate_var_from_path('foo/test/one/two/bar/a'), 'bar__a')
     self.assertEqual(generate_var_from_path('foo/test/one/two/bar/.a'), 'bar___a')