refactor(tests): update test helpers and all test file references
- Rename createTestEbookID to createTestMediaItemID in test_helpers.go - Update test helper comments and variable names (ebookReq -> mediaItemReq, etc.) - Update all test file references: - analytics_test.go - book_matching_test.go - collections_bulk_test.go - kobo_test.go - media_bulk_test.go - opds_test.go - Rename ebookID variable to mediaItemID in kobo_test.go - Update test data to use 'Test Media Item' instead of 'Test Ebook'
This commit is contained in:
@@ -22,7 +22,7 @@ func TestKoboInitialization(t *testing.T) {
|
||||
|
||||
token := loginTestUser(t, ts, db)
|
||||
_ = getTestUserID(t, db)
|
||||
_ = createTestEbookID(t, ts, token)
|
||||
_ = createTestMediaItemID(t, ts, token)
|
||||
|
||||
t.Run("successful initialization", func(t *testing.T) {
|
||||
req, _ := http.NewRequest("GET", ts.URL+"/api/sync/kobo/test-token/v1/initialization", nil)
|
||||
@@ -46,7 +46,7 @@ func TestKoboLibrarySync(t *testing.T) {
|
||||
defer closeTestServer(t, ts, db)
|
||||
|
||||
token := loginTestUser(t, ts, db)
|
||||
_ = createTestEbookID(t, ts, token)
|
||||
_ = createTestMediaItemID(t, ts, token)
|
||||
|
||||
t.Run("successful library sync", func(t *testing.T) {
|
||||
req, _ := http.NewRequest("GET", ts.URL+"/api/sync/kobo/test-token/v1/initialization", nil)
|
||||
@@ -70,13 +70,13 @@ func TestKoboMarkupSync(t *testing.T) {
|
||||
defer closeTestServer(t, ts, db)
|
||||
|
||||
token := loginTestUser(t, ts, db)
|
||||
ebookID := createTestEbookID(t, ts, token)
|
||||
mediaItemID := createTestMediaItemID(t, ts, token)
|
||||
|
||||
t.Run("successful markup sync with annotations and bookmarks", func(t *testing.T) {
|
||||
reqBody := map[string]interface{}{
|
||||
"ReadingSync": []map[string]interface{}{
|
||||
{
|
||||
"ContentId": ebookID,
|
||||
"ContentId": mediaItemID,
|
||||
"PercentRead": 45.6,
|
||||
"EntitlementId": "ent-123",
|
||||
"RemainingTimeMinutes": 120,
|
||||
@@ -86,14 +86,14 @@ func TestKoboMarkupSync(t *testing.T) {
|
||||
"BookmarkSync": []map[string]interface{}{
|
||||
{
|
||||
"BookmarkId": "bookmark-1",
|
||||
"ContentId": ebookID,
|
||||
"ContentId": mediaItemID,
|
||||
"BookmarkText": "This is highlighted text",
|
||||
"BookmarkType": "annotation",
|
||||
"BookmarkTitle": "Chapter 3",
|
||||
},
|
||||
{
|
||||
"BookmarkId": "bookmark-2",
|
||||
"ContentId": ebookID,
|
||||
"ContentId": mediaItemID,
|
||||
"BookmarkText": "This is my note abouts book",
|
||||
"BookmarkType": "bookmark",
|
||||
},
|
||||
@@ -126,14 +126,14 @@ func TestKoboBookmarkSync(t *testing.T) {
|
||||
defer closeTestServer(t, ts, db)
|
||||
|
||||
token := loginTestUser(t, ts, db)
|
||||
ebookID := createTestEbookID(t, ts, token)
|
||||
mediaItemID := createTestMediaItemID(t, ts, token)
|
||||
|
||||
t.Run("successful bookmark sync", func(t *testing.T) {
|
||||
reqBody := map[string]interface{}{
|
||||
"BookmarkSync": []map[string]interface{}{
|
||||
{
|
||||
"BookmarkId": "bookmark-3",
|
||||
"ContentId": ebookID,
|
||||
"ContentId": mediaItemID,
|
||||
"BookmarkText": "Important note abouts book",
|
||||
"BookmarkType": "bookmark",
|
||||
"DateCreated": "2026-01-30T19:55:00Z",
|
||||
@@ -167,14 +167,14 @@ func TestKoboAnalyticsGettests(t *testing.T) {
|
||||
defer closeTestServer(t, ts, db)
|
||||
|
||||
token := loginTestUser(t, ts, db)
|
||||
ebookID := createTestEbookID(t, ts, token)
|
||||
mediaItemID := createTestMediaItemID(t, ts, token)
|
||||
|
||||
t.Run("successful analytics tests", func(t *testing.T) {
|
||||
reqBody := map[string]interface{}{
|
||||
"meta": map[string]string{
|
||||
"name": "Kobo Analytics Tests",
|
||||
},
|
||||
"ContentId": ebookID,
|
||||
"ContentId": mediaItemID,
|
||||
"ReadingEvent": "Reading",
|
||||
"RemainingTimeMin": 180,
|
||||
"PercentRead": 67.8,
|
||||
|
||||
Reference in New Issue
Block a user