|
1 | 1 | import { |
2 | 2 | createAutoModelRequest, |
3 | 3 | encodeSarif, |
4 | | - getCandidates, |
5 | 4 | } from "../../../src/model-editor/auto-model"; |
6 | 5 | import { Mode } from "../../../src/model-editor/shared/mode"; |
7 | 6 | import { AutomodelMode } from "../../../src/model-editor/auto-model-api"; |
8 | 7 | import type { AutoModelQueriesResult } from "../../../src/model-editor/auto-model-codeml-queries"; |
9 | 8 | import type { Log } from "sarif"; |
10 | 9 | import { gzipDecode } from "../../../src/common/zlib"; |
11 | | -import type { Method } from "../../../src/model-editor/method"; |
12 | | -import { EndpointType } from "../../../src/model-editor/method"; |
13 | | -import type { ModeledMethod } from "../../../src/model-editor/modeled-method"; |
14 | 10 |
|
15 | 11 | describe("createAutoModelRequest", () => { |
16 | 12 | const createSarifLog = (queryId: string): Log => { |
@@ -84,118 +80,3 @@ describe("createAutoModelRequest", () => { |
84 | 80 | expect(parsed).toEqual(result.candidates); |
85 | 81 | }); |
86 | 82 | }); |
87 | | - |
88 | | -describe("getCandidates", () => { |
89 | | - it("doesn't return methods that are already modelled", () => { |
90 | | - const methods: Method[] = [ |
91 | | - { |
92 | | - library: "my.jar", |
93 | | - signature: "org.my.A#x()", |
94 | | - endpointType: EndpointType.Method, |
95 | | - packageName: "org.my", |
96 | | - typeName: "A", |
97 | | - methodName: "x", |
98 | | - methodParameters: "()", |
99 | | - supported: false, |
100 | | - supportedType: "none", |
101 | | - usages: [], |
102 | | - }, |
103 | | - ]; |
104 | | - const modeledMethods: Record<string, ModeledMethod[]> = { |
105 | | - "org.my.A#x()": [ |
106 | | - { |
107 | | - type: "neutral", |
108 | | - kind: "sink", |
109 | | - provenance: "manual", |
110 | | - signature: "org.my.A#x()", |
111 | | - endpointType: EndpointType.Method, |
112 | | - packageName: "org.my", |
113 | | - typeName: "A", |
114 | | - methodName: "x", |
115 | | - methodParameters: "()", |
116 | | - }, |
117 | | - ], |
118 | | - }; |
119 | | - const candidates = getCandidates( |
120 | | - Mode.Application, |
121 | | - methods, |
122 | | - modeledMethods, |
123 | | - new Set(), |
124 | | - ); |
125 | | - expect(candidates.length).toEqual(0); |
126 | | - }); |
127 | | - |
128 | | - it("doesn't return methods that are supported from other sources", () => { |
129 | | - const methods: Method[] = [ |
130 | | - { |
131 | | - library: "my.jar", |
132 | | - signature: "org.my.A#x()", |
133 | | - endpointType: EndpointType.Method, |
134 | | - packageName: "org.my", |
135 | | - typeName: "A", |
136 | | - methodName: "x", |
137 | | - methodParameters: "()", |
138 | | - supported: true, |
139 | | - supportedType: "none", |
140 | | - usages: [], |
141 | | - }, |
142 | | - ]; |
143 | | - const modeledMethods = {}; |
144 | | - const candidates = getCandidates( |
145 | | - Mode.Application, |
146 | | - methods, |
147 | | - modeledMethods, |
148 | | - new Set(), |
149 | | - ); |
150 | | - expect(candidates.length).toEqual(0); |
151 | | - }); |
152 | | - |
153 | | - it("doesn't return methods that are already processed by auto model", () => { |
154 | | - const methods: Method[] = [ |
155 | | - { |
156 | | - library: "my.jar", |
157 | | - signature: "org.my.A#x()", |
158 | | - endpointType: EndpointType.Method, |
159 | | - packageName: "org.my", |
160 | | - typeName: "A", |
161 | | - methodName: "x", |
162 | | - methodParameters: "()", |
163 | | - supported: false, |
164 | | - supportedType: "none", |
165 | | - usages: [], |
166 | | - }, |
167 | | - ]; |
168 | | - const modeledMethods = {}; |
169 | | - const candidates = getCandidates( |
170 | | - Mode.Application, |
171 | | - methods, |
172 | | - modeledMethods, |
173 | | - new Set(["org.my.A#x()"]), |
174 | | - ); |
175 | | - expect(candidates.length).toEqual(0); |
176 | | - }); |
177 | | - |
178 | | - it("returns methods that are neither modeled nor supported from other sources", () => { |
179 | | - const methods: Method[] = []; |
180 | | - methods.push({ |
181 | | - library: "my.jar", |
182 | | - signature: "org.my.A#x()", |
183 | | - endpointType: EndpointType.Method, |
184 | | - packageName: "org.my", |
185 | | - typeName: "A", |
186 | | - methodName: "x", |
187 | | - methodParameters: "()", |
188 | | - supported: false, |
189 | | - supportedType: "none", |
190 | | - usages: [], |
191 | | - }); |
192 | | - const modeledMethods = {}; |
193 | | - const candidates = getCandidates( |
194 | | - Mode.Application, |
195 | | - methods, |
196 | | - modeledMethods, |
197 | | - new Set(), |
198 | | - ); |
199 | | - expect(candidates.length).toEqual(1); |
200 | | - }); |
201 | | -}); |
0 commit comments