Exemple #1
0
    def test_same_path_relative_index_require(self):
        cut = NodeDeclaration("./")
        origin_block_cell_name = BlockCellName("fran/noderedis/bench.js")
        block_cell_names = [
            BlockCellName("fran/noderedis/index.js"),
            BlockCellName("fran/noderedis/client.js")
        ]

        m = cut.match(block_cell_names, origin_block_cell_name)
        self.assertItemsEqual(set(["fran/noderedis/index.js"]), m)
Exemple #2
0
    def test_match_with_implicit_require(self):
        cut = NodeDeclaration("fran/noderedis")

        block_cell_names = [
            BlockCellName("fran/noderedis/index.js"),
            BlockCellName("fran/noderedis/other.js")
        ]

        self.assertItemsEqual(set([BlockCellName("fran/noderedis/index.js")]),
                              cut.match(block_cell_names))
Exemple #3
0
    def test_package_json_recognition(self):
        cut = NodeDeclaration("fran/noderedis")

        block_cell_names = [
            BlockCellName("fran/noderedis/package.json"),
            BlockCellName("fran/noderedis/other.js")
        ]

        self.assertItemsEqual(
            set([BlockCellName("fran/noderedis/package.json")]),
            cut.match(block_cell_names))
Exemple #4
0
    def test_one_level_relative_require_with_depth(self):
        cut = NodeDeclaration("./lib/parser/queue")
        origin_block_cell_name = BlockCellName("fran/noderedis/index.js")

        block_cell_names = [
            BlockCellName("fran/noderedis/index.js"),
            BlockCellName("fran/noderedis/lib/queue.js"),
            BlockCellName("fran/noderedis/lib/parser/queue.js")
        ]

        self.assertItemsEqual(
            set(["fran/noderedis/lib/parser/queue.js"]),
            cut.match(block_cell_names, origin_block_cell_name))
Exemple #5
0
    def test_relative_require_not_found(self):
        cut = NodeDeclaration("../parser")
        origin_block_cell_name = BlockCellName(
            "fran/noderedis/other/thing/other.js")

        block_cell_names = [
            BlockCellName("fran/noderedis/index.js"),
            BlockCellName("fran/noderedis/other/thing/other.js"),
            BlockCellName("fran/noderedis/parser.js")
        ]

        self.assertItemsEqual(
            set(), cut.match(block_cell_names, origin_block_cell_name))