diff options
| author | Franck Cuny <franck@fcuny.net> | 2025-08-29 09:23:18 -0700 |
|---|---|---|
| committer | Franck Cuny <franck@fcuny.net> | 2025-08-29 09:23:18 -0700 |
| commit | 91ead5e4493bb459ea537ad204e7e6b3d15a220b (patch) | |
| tree | f712f9d75a969479bda177bc439918ed2a1008f0 /internal/scrobbler/record_test.go | |
| parent | fix readme for x509-info project (diff) | |
| parent | prepare the migration (diff) | |
| download | x-91ead5e4493bb459ea537ad204e7e6b3d15a220b.tar.gz | |
Merge remote-tracking branch 'import/main'
Diffstat (limited to '')
| -rw-r--r-- | internal/scrobbler/record_test.go | 53 |
1 files changed, 53 insertions, 0 deletions
diff --git a/internal/scrobbler/record_test.go b/internal/scrobbler/record_test.go new file mode 100644 index 0000000..3bf8554 --- /dev/null +++ b/internal/scrobbler/record_test.go @@ -0,0 +1,53 @@ +package scrobbler + +import ( + "testing" + + "github.com/fhs/gompd/v2/mpd" +) + +func TestNewRecord(t *testing.T) { + song := mpd.Attrs{ + "Artist": "Nine Inch Nails", + "Album": "The Downward Spiral", + "Title": "Reptile", + "duration": "411.00", + } + + record, err := NewRecord(song) + if err != nil { + t.Errorf("NewRecord returned an error: %s", err) + } + if record == nil { + t.Errorf("NewRecord returned nil record") + } +} + +func TestRecordEqualAttrs(t *testing.T) { + s1 := mpd.Attrs{ + "Artist": "Nine Inch Nails", + "Album": "The Downward Spiral", + "Title": "Reptile", + "duration": "411.00", + } + + s2 := mpd.Attrs{ + "Artist": "Nine Inch Nails", + "Album": "The Downward Spiral", + "Title": "Closer", + "duration": "373.00", + } + + r, err := NewRecord(s1) + if err != nil { + t.Errorf("NewRecord returned an error: %s", err) + } + + if !r.EqualAttrs(s1) { + t.Errorf("EqualAttrs expected true got false") + } + + if r.EqualAttrs(s2) { + t.Errorf("EqualAttrs expected false got true") + } +} |
