Beispiel #1
0
    def test_empty_lock(self):
        lock_file = """{
  "type": "success",
  "object": {}
}
"""
        package_map = parse_yarn_lock(json.loads(lock_file))
        self.assertFalse(package_map)
Beispiel #2
0
    def test_sign_child_lock(self):
        lock_file = """{
  "type": "success",
  "object": {
    "@toolbox-core@^1.0.1": {
      "version": "1.1.1"
    }
  }
}
"""
        package_map = parse_yarn_lock(json.loads(lock_file))
        self.assertEqual(package_map.get("@toolbox-core@^1.0.1"), "1.1.1")
Beispiel #3
0
    def test_multiple_children_lock(self):
        lock_file = """{
  "type": "success",
  "object": {
    "toolbox-core@^1.0.1": {
      "version": "1.1.1"
    },
    "toolbox-core1@^1.0.1": {
      "version": "1.1.2"
    },
    "toolbox-core2@^1.0.1": {
      "version": "1.1.3"
    }
  }
}
"""
        package_map = parse_yarn_lock(json.loads(lock_file))
        self.assertEqual(package_map.get("toolbox-core@^1.0.1"), "1.1.1")
        self.assertEqual(package_map.get("toolbox-core1@^1.0.1"), "1.1.2")
        self.assertEqual(package_map.get("toolbox-core2@^1.0.1"), "1.1.3")