Skip to content

Commit

Permalink
test: add test case to validate nested gradle policies are included
Browse files Browse the repository at this point in the history
  • Loading branch information
thisislawatts committed Sep 18, 2024
1 parent a460785 commit dd3b268
Showing 1 changed file with 10 additions and 0 deletions.
10 changes: 10 additions & 0 deletions test/tap/cli-monitor/cli-monitor.all-projects.spec.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as sinon from 'sinon';
import * as path from 'path';
import * as depGraphLib from '@snyk/dep-graph';
import { getWorkspacePath } from '../../jest/util/getWorkspacePath';

interface AcceptanceTests {
language: string;
Expand Down Expand Up @@ -412,6 +413,9 @@ export const AllProjectsTests: AcceptanceTests = {
},
},
depGraph: simpleGradleGraph,
targetFile:
getWorkspacePath('gradle-monorepo') +
'/subproj/build.gradle',
},
],
};
Expand All @@ -437,6 +441,7 @@ export const AllProjectsTests: AcceptanceTests = {
'gradle project was monitored',
);

let policyCount = 0;
const requests = params.server
.getRequests()
.filter((req) => req.url.includes('/monitor/'));
Expand All @@ -447,6 +452,10 @@ export const AllProjectsTests: AcceptanceTests = {
/\/api\/v1\/monitor\/(npm\/graph|gradle\/graph)/,
'puts at correct url',
);

if (req.body.policy) {
policyCount++;
}
t.notOk(req.body.targetFile, "doesn't send the targetFile");
t.equal(req.method, 'PUT', 'makes PUT request');
t.equal(
Expand All @@ -455,6 +464,7 @@ export const AllProjectsTests: AcceptanceTests = {
'sends version number',
);
});
t.equal(policyCount, 1, '1 nested policy found in monorepo');
},
'`monitor kotlin-monorepo --all-projects` scans kotlin files':
(params, utils) => async (t) => {
Expand Down

0 comments on commit dd3b268

Please sign in to comment.