Skip to content

Commit 5289e4f

Browse files
committed
JS: Fix a bug in a unit test
The 'extractTypeScriptFiles' override did not incorporate the file type and one of our unit tests was expecting this. The test was previously passing for the wrong reasons.
1 parent 02cdde1 commit 5289e4f

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

javascript/extractor/test/com/semmle/js/extractor/test/AutoBuildTests.java

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -111,12 +111,17 @@ private void runTest() throws IOException {
111111
try {
112112
Set<String> actual = new LinkedHashSet<>();
113113
new AutoBuild() {
114-
@Override
115-
protected CompletableFuture<?> extract(FileExtractor extractor, Path file, boolean concurrent) {
114+
private void markExtracted(Path file, FileExtractor extractor) {
116115
String extracted = file.toString();
117-
if (extractor.getConfig().hasFileType())
116+
if (extractor.getConfig().hasFileType()) {
118117
extracted += ":" + extractor.getFileType(file.toFile());
118+
}
119119
actual.add(extracted);
120+
}
121+
122+
@Override
123+
protected CompletableFuture<?> extract(FileExtractor extractor, Path file, boolean concurrent) {
124+
markExtracted(file, extractor);
120125
return CompletableFuture.completedFuture(null);
121126
}
122127

@@ -134,7 +139,7 @@ public void extractTypeScriptFiles(
134139
java.util.Set<Path> extractedFiles,
135140
FileExtractors extractors) {
136141
for (Path f : files) {
137-
actual.add(f.toString());
142+
markExtracted(f, extractors.forFile(f));
138143
extractedFiles.add(f);
139144
}
140145
}

0 commit comments

Comments
 (0)