(az: Analyzer)
| 46 | |
| 47 | |
| 48 | def test_az(az: Analyzer): |
| 49 | my_env = os.environ.copy() |
| 50 | my_env["PORT"] = str(server_port) |
| 51 | p = subprocess.Popen(['node', server_path], env=my_env) |
| 52 | |
| 53 | try: |
| 54 | # wait for the server to spin up |
| 55 | time.sleep(1.0) |
| 56 | az.graph_server.reset_graph() |
| 57 | az.analyze() |
| 58 | # assert_graph_match_history(az) |
| 59 | |
| 60 | history_truth = { |
| 61 | 'C': {'main.js:funcB:9:12': 1, |
| 62 | 'main.js:global': 1, |
| 63 | 'main.js:main:7:16': 1}, |
| 64 | 'B': {'main.js:funcB:9:11': 3, |
| 65 | 'main.js:global': 7, |
| 66 | 'main.js:main:7:15': 7}, |
| 67 | 'A': {'main.js:funcA:3:5': 3, |
| 68 | 'main.js:main:7:10': 4, |
| 69 | 'main.js:global': 12} |
| 70 | } |
| 71 | |
| 72 | for commit in az.ri.repo.iter_commits(): |
| 73 | assert(az.history[commit.hexsha] == |
| 74 | history_truth[commit.message.strip()]) |
| 75 | |
| 76 | edges_truth = [ |
| 77 | ('main.js:funcB:9:12', 'Native:Window_prototype_print'), |
| 78 | ('main.js:funcB:9:12', 'main.js:funcA:3:5'), |
| 79 | ('main.js:funcA:3:5', 'Native:Window_prototype_print'), |
| 80 | ('main.js:main:7:16', 'main.js:funcB:9:12'), |
| 81 | ('main.js:main:7:16', 'main.js:funcA:3:5'), |
| 82 | ('main.js:global', 'main.js:main:7:16') |
| 83 | ] |
| 84 | assert(set(az.graph_server.get_graph().edges()) == set(edges_truth)) |
| 85 | |
| 86 | finally: |
| 87 | p.terminate() |
nothing calls this directly
no test coverage detected