mirror of
https://github.com/idanoo/autobrr
synced 2025-07-23 00:39:13 +00:00
feat: show new updates in dashboard (#690)
* feat: show new update banner * feat(http): add request logger * refactor: updates checker * feat: make update check optional * fix: empty releases * add toggle switch for update checks * feat: toggle updates check from settings * feat: toggle updates check from settings * feat: check on toggle enabled --------- Co-authored-by: soup <soup@r4tio.dev>
This commit is contained in:
parent
3fdd7cf5e4
commit
2917a7d42d
24 changed files with 687 additions and 121 deletions
55
internal/config/config_test.go
Normal file
55
internal/config/config_test.go
Normal file
|
@ -0,0 +1,55 @@
|
|||
package config
|
||||
|
||||
import (
|
||||
"reflect"
|
||||
"sync"
|
||||
"testing"
|
||||
|
||||
"github.com/autobrr/autobrr/internal/domain"
|
||||
)
|
||||
|
||||
func TestAppConfig_processLines(t *testing.T) {
|
||||
type fields struct {
|
||||
Config *domain.Config
|
||||
m sync.Mutex
|
||||
}
|
||||
type args struct {
|
||||
lines []string
|
||||
}
|
||||
tests := []struct {
|
||||
name string
|
||||
fields fields
|
||||
args args
|
||||
want []string
|
||||
}{
|
||||
{
|
||||
name: "append missing",
|
||||
fields: fields{
|
||||
Config: &domain.Config{CheckForUpdates: true},
|
||||
m: sync.Mutex{},
|
||||
},
|
||||
args: args{[]string{}},
|
||||
want: []string{"# Check for updates", "#", "checkForUpdates = true"},
|
||||
},
|
||||
{
|
||||
name: "update existing",
|
||||
fields: fields{
|
||||
Config: &domain.Config{CheckForUpdates: true},
|
||||
m: sync.Mutex{},
|
||||
},
|
||||
args: args{[]string{"# Check for updates", "#", "#checkForUpdates = false"}},
|
||||
want: []string{"# Check for updates", "#", "checkForUpdates = true"},
|
||||
},
|
||||
}
|
||||
for _, tt := range tests {
|
||||
t.Run(tt.name, func(t *testing.T) {
|
||||
c := &AppConfig{
|
||||
Config: tt.fields.Config,
|
||||
m: tt.fields.m,
|
||||
}
|
||||
if got := c.processLines(tt.args.lines); !reflect.DeepEqual(got, tt.want) {
|
||||
t.Errorf("processLines() = %v, want %v", got, tt.want)
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue