Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JS-402 Fix PRAnalysisTest #4895

Merged
merged 3 commits into from
Nov 8, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@

import static java.lang.String.format;
import static java.util.regex.Pattern.compile;
import static java.util.stream.Collectors.toList;
import static org.assertj.core.api.Assertions.fail;
import static org.assertj.core.api.Assertions.tuple;

Expand Down Expand Up @@ -147,10 +146,19 @@ public BuildResultAssert generatesUcfgFilesForAll(Path projectPath, String... fi
List<Path> ucfgFiles;
try {
ucfgFiles = findUcfgFilesIn(projectPath);
for (var filename : filenames) {
for (var ucfgFile : ucfgFiles) {
// Filenames: file2_SomeLambdaFunction_yaml
// ucfgFile: /Users/VICTOR~1.DIE/AppData/Local/Temp/junit14107160890921213721/pr-analysis-yaml/.scannerwork/ucfg2/js/daFunction_yaml_1.ucfgs
// We check if file2_SomeLambdaFunction_yaml ends with daFunction_yaml
// or
// Filenames: index.ts
// ucfg: /Users/VICTOR~1.DIE/AppData/Local/Temp/junit2107948845245431806/pr-analysis-ts/.scannerwork/ucfg2/js/sis_ts_index_ts.ucfgs
// We check if sis_ts_index_ts ends with index_ts

var key = ucfgFile.getFileName().toString().replaceFirst("(_\\d+)?[.][^.]+$", ""); // We remove index and extension: _1.ucfgs
Assertions
.assertThat(ucfgFiles)
.filteredOn(file -> file.getFileName().toString().contains(filename.replace('.', '_')))
.assertThat(filenames)
.filteredOn(filename -> filename.replace('.', '_').endsWith(key) || key.endsWith(filename.replace('.', '_')))
.isNotEmpty();
}
} catch (IOException e) {
Expand Down