Skip to content

Commit e30f6bc

Browse files
authored
Merge pull request #6476 from snyk/chore/more-uv-acceptance-tests
chore: more uv acceptance tests
2 parents cb17aa3 + 447c84c commit e30f6bc

File tree

3 files changed

+46
-0
lines changed

3 files changed

+46
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
[project]
2+
name = "uv-test"
3+
version = "0.1.0"
4+
description = "Add your description here"
5+
readme = "README.md"
6+
requires-python = ">=3.11"
7+
dependencies = []

test/fixtures/uv-no-deps/uv.lock

Lines changed: 8 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

test/jest/acceptance/snyk-test/uv.spec.ts

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -104,4 +104,35 @@ describe('uv lock acceptance', () => {
104104
expect(paths).not.toContain(`/rest/orgs/${orgId}/tests`);
105105
expect(paths).not.toContain(`/hidden/orgs/${orgId}/sboms/convert`);
106106
});
107+
108+
test('succeeds for uv project with no dependencies', async () => {
109+
server.setFeatureFlag('enableUvCLI', true);
110+
111+
const project = await createProject('uv-no-deps');
112+
const { code } = await runSnykCLI('test --json', {
113+
cwd: project.path(),
114+
env: {
115+
...env,
116+
XDG_CONFIG_HOME: project.path(),
117+
},
118+
});
119+
120+
expect(code).toEqual(0);
121+
122+
const requests = server.getRequests();
123+
const paths = requests.map((req) => req.path);
124+
const orgId = '55555555-5555-5555-5555-555555555555';
125+
126+
expect(paths).toContain('/v1/cli-config/feature-flags/enableUvCLI');
127+
expect(paths).toContain(`/rest/orgs/${orgId}/tests`);
128+
129+
const createTestReq = requests.find(
130+
(req) =>
131+
req.method === 'POST' && req.path === `/rest/orgs/${orgId}/tests`,
132+
);
133+
expect(createTestReq).toBeDefined();
134+
const depGraph: DepGraph =
135+
createTestReq?.body?.data?.attributes?.subject?.dep_graph;
136+
expect(depGraph).toBeDefined();
137+
});
107138
});

0 commit comments

Comments
 (0)