-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathrepo-scan-python-detection.test.ts
More file actions
37 lines (29 loc) · 1.18 KB
/
repo-scan-python-detection.test.ts
File metadata and controls
37 lines (29 loc) · 1.18 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
import { describe, expect, it } from "vitest"
import { detectPythonTestingSignals } from "@/lib/repo-scan/python-testing-signals"
import type { PackageJson } from "@/types/repo-scan"
const createPkg = (deps: Partial<PackageJson>): PackageJson => ({ ...deps })
describe("detectPythonTestingSignals", () => {
it("adds behave when features directory structure is present", async () => {
const testing = new Set<string>()
await detectPythonTestingSignals(
["features/example.feature", "features/steps/login_steps.py", "features/environment.py"],
null,
testing,
)
expect(Array.from(testing)).toContain("behave")
})
it("adds behave when dependency is detected", async () => {
const testing = new Set<string>()
await detectPythonTestingSignals(
[],
createPkg({ devDependencies: { behave: "^1.2.3" } }),
testing,
)
expect(Array.from(testing)).toContain("behave")
})
it("adds unittest when Python-style test files exist", async () => {
const testing = new Set<string>()
await detectPythonTestingSignals(["tests/test_example.py", "src/app.py"], null, testing)
expect(Array.from(testing)).toContain("unittest")
})
})