mirror of
https://git.sr.ht/~phw/scotty
synced 2025-04-25 13:57:56 +02:00
Run exporter in goroutine
Use channel to pass data from exporter to importer
This commit is contained in:
parent
1ba165a631
commit
298697dcfc
7 changed files with 124 additions and 42 deletions
|
@ -22,7 +22,9 @@ THE SOFTWARE.
|
|||
package models_test
|
||||
|
||||
import (
|
||||
"sort"
|
||||
"testing"
|
||||
"time"
|
||||
|
||||
"github.com/stretchr/testify/assert"
|
||||
"go.uploadedlobster.com/scotty/models"
|
||||
|
@ -38,3 +40,25 @@ func TestTrackArtistName(t *testing.T) {
|
|||
}
|
||||
assert.Equal(t, "Foo, Bar, Baz", track.ArtistName())
|
||||
}
|
||||
|
||||
func TestListensListSort(t *testing.T) {
|
||||
listen1 := models.Listen{ListenedAt: time.Unix(3, 0)}
|
||||
listen2 := models.Listen{ListenedAt: time.Unix(0, 0)}
|
||||
listen3 := models.Listen{ListenedAt: time.Unix(2, 0)}
|
||||
list := models.ListensList{listen1, listen2, listen3}
|
||||
sort.Sort(list)
|
||||
assert.Equal(t, listen1, list[2])
|
||||
assert.Equal(t, listen2, list[0])
|
||||
assert.Equal(t, listen3, list[1])
|
||||
}
|
||||
|
||||
func TestLovesListSort(t *testing.T) {
|
||||
love1 := models.Love{Created: time.Unix(3, 0)}
|
||||
love2 := models.Love{Created: time.Unix(0, 0)}
|
||||
love3 := models.Love{Created: time.Unix(2, 0)}
|
||||
list := models.LovesList{love1, love2, love3}
|
||||
sort.Sort(list)
|
||||
assert.Equal(t, love1, list[2])
|
||||
assert.Equal(t, love2, list[0])
|
||||
assert.Equal(t, love3, list[1])
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue