Ejemplo n.º 1
0
 def test_can_generate_a_webpack_config_for_a_js_component_with_a_devtool(
         self):
     config = generate_config_for_component(Components.HELLO_WORLD_JS,
                                            devtool='eval')
     self.validate_generated_config(config,
                                    Components.HELLO_WORLD_JS,
                                    devtool='eval')
Ejemplo n.º 2
0
    def test_can_get_a_path_to_a_config_file(self):
        config = generate_config_for_component(Components.HELLO_WORLD_JS)

        config_file = generate_config_file(config)

        path = get_path_to_config_file(config_file)

        self.assertEqual(config_file.generate_path_to_file(), path)

        self.assertTrue(os.path.exists(path))

        with open(path, 'r') as output_file:
            content = output_file.read()

        self.assertEqual(content, config_file.render())
Ejemplo n.º 3
0
    def test_can_get_a_path_to_a_config_file(self):
        config = generate_config_for_component(Components.HELLO_WORLD_JS)

        config_file = generate_config_file(config)

        path = get_path_to_config_file(config_file)

        self.assertEqual(config_file.generate_path_to_file(), path)

        self.assertTrue(os.path.exists(path))

        with open(path, 'r') as output_file:
            content = output_file.read()

        self.assertEqual(content, config_file.render())
Ejemplo n.º 4
0
    def test_can_generate_and_create_a_config_file(self):
        config = generate_config_for_component(Components.HELLO_WORLD_JS)

        config_file = generate_config_file(config)
        self.assertIsInstance(config_file, ConfigFile)

        self.assertIsInstance(config_file.content[0], JS)
        self.assertEqual(config_file.content[0].content, 'var path = require("path");\n')

        self.assertIsInstance(config_file.content[1], JS)
        self.assertEqual(config_file.content[1].content, 'module.exports = ')

        self.assertEqual(config_file.content[2], config)
        self.validate_generated_config(config_file.content[2], Components.HELLO_WORLD_JS)

        self.assertIsInstance(config_file.content[3], JS)
        self.assertEqual(config_file.content[3].content, ';')
Ejemplo n.º 5
0
    def test_can_generate_and_create_a_config_file(self):
        config = generate_config_for_component(Components.HELLO_WORLD_JS)

        config_file = generate_config_file(config)
        self.assertIsInstance(config_file, ConfigFile)

        self.assertIsInstance(config_file.content[0], JS)
        self.assertEqual(config_file.content[0].content,
                         'var path = require("path");\n')

        self.assertIsInstance(config_file.content[1], JS)
        self.assertEqual(config_file.content[1].content, 'module.exports = ')

        self.assertEqual(config_file.content[2], config)
        self.validate_generated_config(config_file.content[2],
                                       Components.HELLO_WORLD_JS)

        self.assertIsInstance(config_file.content[3], JS)
        self.assertEqual(config_file.content[3].content, ';')
Ejemplo n.º 6
0
 def test_can_generate_a_webpack_config_for_a_js_component_with_a_devtool(self):
     config = generate_config_for_component(Components.HELLO_WORLD_JS, devtool='eval')
     self.validate_generated_config(config, Components.HELLO_WORLD_JS, devtool='eval')
Ejemplo n.º 7
0
 def test_can_generate_a_webpack_config_for_a_js_component(self):
     config = generate_config_for_component(Components.HELLO_WORLD_JS)
     self.validate_generated_config(config, Components.HELLO_WORLD_JS)
Ejemplo n.º 8
0
 def test_can_generate_a_webpack_config_for_a_js_component(self):
     config = generate_config_for_component(Components.HELLO_WORLD_JS)
     self.validate_generated_config(config, Components.HELLO_WORLD_JS)