fix opts test

fix opts categories handle
This commit is contained in:
rumanzo 2023-11-25 23:37:21 +03:00
parent 61abb0345d
commit 7b9c97cfe1
No known key found for this signature in database
2 changed files with 2 additions and 2 deletions

View File

@ -74,7 +74,7 @@ func HandleOpts(opts *Opts) {
qbtRootDir, _ := strings.CutSuffix(qbtDir, `data/BT_backup`) qbtRootDir, _ := strings.CutSuffix(qbtDir, `data/BT_backup`)
// check that user not define categories // check that user not define categories
refOpts := MakeOpts() refOpts := PrepareOpts()
if refOpts.Categories == opts.Categories { if refOpts.Categories == opts.Categories {
opts.Categories = fileHelpers.Join([]string{qbtRootDir, `config/categories.json`}, opts.PathSeparator) opts.Categories = fileHelpers.Join([]string{qbtRootDir, `config/categories.json`}, opts.PathSeparator)
} }

View File

@ -167,7 +167,7 @@ func TestOptionsHandle(t *testing.T) {
for _, testCase := range cases { for _, testCase := range cases {
t.Run(testCase.name, func(t *testing.T) { t.Run(testCase.name, func(t *testing.T) {
if testCase.opts.Categories == `` { if testCase.opts.Categories == `` {
refOpts := MakeOpts() refOpts := PrepareOpts()
testCase.opts.Categories = refOpts.Categories testCase.opts.Categories = refOpts.Categories
} }
HandleOpts(testCase.opts) HandleOpts(testCase.opts)