/
githubmirror
/
trivy
Обзор
Документация
Войти
/
githubmirror
/
trivy
Код
Задачи
Вики
Пакеты
0
Релизы
0
Аналитика
Безопасность
main
pkg/x/path/path_test.go
50 строк
806 B
Nikita Pivkin
fix(nodejs): do not detect lock file in node_modules as an app (#4949)
06 авг 2023, 11:59
Не верифицирован
06 авг 2023, 11:59
067a0fc
Код
Авторство
О чём код?
package path import ( "testing" "github.com/stretchr/testify/assert" ) func TestContains(t *testing.T) { type args struct { filePath string subpath string } tests := []struct { name string args args want bool }{ { name: "file", args: args{ filePath: "go.mod", subpath: "go.mod", }, want: true, }, { name: "dir", args: args{ filePath: "app/node_modules/express/package.json", subpath: "node_modules", }, want: true, }, { name: "path", args: args{ filePath: "app/node_modules/express/package.json", subpath: "app/node_modules", }, want: false, }, } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { got := Contains(tt.args.filePath, tt.args.subpath) assert.Equal(t, tt.want, got) }) } }