mirror of
https://github.com/gabehf/Koito.git
synced 2026-03-16 02:45:54 -07:00
fix: workflow + test
This commit is contained in:
parent
57b172cf90
commit
e3f4e959f4
2 changed files with 8 additions and 6 deletions
4
.github/workflows/astro.yml
vendored
4
.github/workflows/astro.yml
vendored
|
|
@ -24,8 +24,8 @@ jobs:
|
||||||
uses: withastro/action@v4
|
uses: withastro/action@v4
|
||||||
with:
|
with:
|
||||||
path: ./docs # The root location of your Astro project inside the repository. (optional)
|
path: ./docs # The root location of your Astro project inside the repository. (optional)
|
||||||
# node-version: 22 # The specific version of Node that should be used to build your site. Defaults to 22. (optional)
|
node-version: 20 # The specific version of Node that should be used to build your site. Defaults to 22. (optional)
|
||||||
package-manager: yarn@latest # The Node package manager that should be used to install dependencies and build your site. Automatically detected based on your lockfile. (optional)
|
package-manager: yarn@1.22.22 # The Node package manager that should be used to install dependencies and build your site. Automatically detected based on your lockfile. (optional)
|
||||||
|
|
||||||
deploy:
|
deploy:
|
||||||
needs: build
|
needs: build
|
||||||
|
|
|
||||||
|
|
@ -17,6 +17,7 @@ func flattenListenCounts(items []db.ListenActivityItem) []int64 {
|
||||||
return ret
|
return ret
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// TODO: This test has some inherent flakiness due to local time possibly crossing day boundaries with UTC
|
||||||
func TestListenActivity(t *testing.T) {
|
func TestListenActivity(t *testing.T) {
|
||||||
truncateTestData(t)
|
truncateTestData(t)
|
||||||
|
|
||||||
|
|
@ -130,8 +131,8 @@ func TestListenActivity(t *testing.T) {
|
||||||
|
|
||||||
err = store.Exec(context.Background(), `
|
err = store.Exec(context.Background(), `
|
||||||
INSERT INTO listens (user_id, track_id, listened_at)
|
INSERT INTO listens (user_id, track_id, listened_at)
|
||||||
VALUES (1, 1, DATE '2024-03-10'),
|
VALUES (1, 1, TIMESTAMP WITH TIME ZONE '2024-03-10T12:00:00Z'),
|
||||||
(1, 2, DATE '2024-03-20')`)
|
(1, 2, TIMESTAMP WITH TIME ZONE '2024-03-20T12:00:00Z')`)
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
|
|
||||||
activity, err = store.GetListenActivity(ctx, db.ListenActivityOpts{
|
activity, err = store.GetListenActivity(ctx, db.ListenActivityOpts{
|
||||||
|
|
@ -141,8 +142,9 @@ func TestListenActivity(t *testing.T) {
|
||||||
})
|
})
|
||||||
require.NoError(t, err)
|
require.NoError(t, err)
|
||||||
require.Len(t, activity, 31) // number of days in march
|
require.Len(t, activity, 31) // number of days in march
|
||||||
assert.EqualValues(t, 1, activity[8].Listens)
|
t.Log(activity)
|
||||||
assert.EqualValues(t, 1, activity[18].Listens)
|
assert.EqualValues(t, 1, activity[9].Listens)
|
||||||
|
assert.EqualValues(t, 1, activity[19].Listens)
|
||||||
|
|
||||||
// Truncate and insert listens associated with two different albums
|
// Truncate and insert listens associated with two different albums
|
||||||
err = store.Exec(context.Background(), `TRUNCATE TABLE listens RESTART IDENTITY`)
|
err = store.Exec(context.Background(), `TRUNCATE TABLE listens RESTART IDENTITY`)
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue