1// SPDX-License-Identifier: AGPL-3.0-or-later
2
3package domain
4
5import "testing"
6
7func TestIsGeneratedPath(t *testing.T) {
8 t.Parallel()
9 tests := []struct {
10 path string
11 want bool
12 }{
13 {"views/a_templ.go", true},
14 {"api/x.pb.go", true},
15 {"x_gen.go", true},
16 {"x.gen.go", true},
17 {"static/app.min.js", true},
18 {"static/app.min.css", true},
19 {"static/app.js.map", true},
20 {"static/app.css.map", true},
21 {"go.sum", true},
22 {"web/package-lock.json", true},
23 {"pnpm-lock.yaml", true},
24 {"yarn.lock", true},
25 {"Cargo.lock", true},
26 {"bun.lockb", true},
27 {"bun.lock", true},
28 {"composer.lock", true},
29 {"Gemfile.lock", true},
30 {"poetry.lock", true},
31 {"uv.lock", true},
32 {"flake.lock", true},
33 {"vendor/x.go", true},
34 {"a/vendor/b/x.go", true},
35 {"node_modules/a.js", true},
36 {"web/node_modules/a.js", true},
37 {"vendor.go", false},
38 {"templ.go", false},
39 {"main.go", false},
40 {"go.mod", false},
41 {"minify.js", false},
42 {"myvendor/x.go", false},
43 {"x.min.jsx", false},
44 {"", false},
45 }
46 for _, tt := range tests {
47 if got := IsGeneratedPath(tt.path); got != tt.want {
48 t.Errorf("IsGeneratedPath(%q) = %v, want %v", tt.path, got, tt.want)
49 }
50 }
51}