gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commit29a26da929a26da9|||PR AP56e: guard hidden show helpers during session syncTracker29a26da9/tests/seed-status.hl

4.4 KB

  1. // tests/seed-status.hl — GATE FIXTURE for tracker#35 (mission 030): written by tests/browser.mjs into the gate's storage while the
  2. // app is STOPPED (one process per storage, hybriel#21). Four complete series (synced: `tmdbSync`) with TMDB's status and a TVmaze
  3. // id but no TVmaze status yet — the status backfill (backfill.hl tvmazeStatusTitle) asks the fake TVmaze for each:
  4. // Running Gate Series TMDB 'Returning Series', TVmaze 5501 'Running' → pill "Returning" (green; mission 033: episodes 10
  5. // days ago and in 10 days — outside the ±7 days —
  6. // and a SPECIAL (season 0) in 2 days: no "Airing")
  7. // Airing Gate Series TMDB 'Returning Series', TVmaze 5503 'Running' → "Airing" (an episode in 3 days)
  8. // Aired Gate Series TMDB 'Returning Series', TVmaze 5505 'Running' → "Airing" (an episode 7 days ago: the edge)
  9. // Canceled Gate Series TMDB 'Canceled', TVmaze 5502 'Ended' → pill "Canceled" (red: TVmaze has no canceled)
  10. // Gone Maze Series TMDB 'Ended', TVmaze 5504 → 404 → `tvmazeStatusCheck`, pill "Ended" (muted)
  11. // Pending Gate Series TMDB 'In Production', no TVmaze id → never asked, pill "In Production" (yellow)
  12. // Variety Gate Series TMDB type 'Scripted' (a series), TVmaze 5506 'Running', type 'Variety' → #43 (mission 037): a SHOW
  13. // once TVmaze's type is stored — moves from /series to /shows (like Saturday Night Live UK)
  14. import { MPackDB } from 'hl:mpackdb'
  15. import { env } from 'hl:proc'
  16. import { now, timestamp } from 'hl:time'
  17. storageDir = env('TRACKER_STORAGE')
  18. if (storageDir == null || !storageDir.startsWith('/')) { hlError('set TRACKER_STORAGE, absolute') }
  19. showsTable = new MPackDB(file = storageDir + '/shows.db', primaryKey = '@id', indexes = ['!oldId'])
  20. seasonsTable = new MPackDB(file = storageDir + '/seasons.db', primaryKey = '@id', indexes = ['!oldId'])
  21. episodesTable = new MPackDB(file = storageDir + '/episodes.db', primaryKey = '@id', indexes = ['!oldId'])
  22. day = (n) => { return timestamp(now() + n * 86400000).slice(0, 10) }
  23. // a season with an episode per date (mission 033: Returning vs Airing); returns its id
  24. season = (showId, no, dates) => {
  25. sid = showId + 's' + no
  26. eps = []
  27. let k = 0
  28. while (k < dates.length) {
  29. let eid = sid + 'e' + k
  30. episodesTable.put({ id = eid episodeNumber = k + 1 seasonNumber = no title = 'Episode ' + (k + 1) summary = null release = dates[k] show = showId season = sid oldId = eid })
  31. eps.push(eid)
  32. k = k + 1
  33. }
  34. seasonsTable.put({ id = sid seasonNumber = no title = null release = null summary = null show = showId episodes = eps oldId = sid })
  35. return sid
  36. }
  37. series = (id, tmdbId, name, slug, status, tvmzId) => {
  38. return { adult = false id = id title = name summary = 'A #35 fixture.' tmdbSummary = null tmdbId = tmdbId
  39. language = 'en' type = 'series' kind = 'series' release = '2015-01-01' year = 2015 image = null urlSegment = slug
  40. episodesCount = 0 homepage = null imdbId = null seasonsCount = 0 status = status tagline = null
  41. tvdbId = null tvmzId = tvmzId genres = [] cast = [] seasons = [] oldId = 'st-' + tmdbId creditsAt = 1 detailsAt = 1 tmdbSync = 1 }
  42. }
  43. r1 = series('st00000000000sr1', 1501, 'Running Gate Series', 'running-gate-series', 'Returning Series', 5501)
  44. r1.seasons = [season(r1.id, 1, [day(-10), day(10)]), season(r1.id, 0, [day(2)])]
  45. showsTable.put(r1)
  46. a1 = series('st00000000000sr5', 1505, 'Airing Gate Series', 'airing-gate-series', 'Returning Series', 5503)
  47. a1.seasons = [season(a1.id, 1, [day(-30), day(3)])]
  48. showsTable.put(a1)
  49. a2 = series('st00000000000sr6', 1506, 'Aired Gate Series', 'aired-gate-series', 'Returning Series', 5505)
  50. a2.seasons = [season(a2.id, 1, [day(-7)])]
  51. showsTable.put(a2)
  52. showsTable.put(series('st00000000000sr2', 1502, 'Canceled Gate Series', 'canceled-gate-series', 'Canceled', 5502))
  53. showsTable.put(series('st00000000000sr4', 1504, 'Gone Maze Series', 'gone-maze-series', 'Ended', 5504))
  54. showsTable.put(series('st00000000000sr3', 1503, 'Pending Gate Series', 'pending-gate-series', 'In Production', null))
  55. v1 = series('st00000000000sr7', 1507, 'Variety Gate Series', 'variety-gate-series', 'Returning Series', 5506)
  56. v1.tmdbType = 'Scripted'
  57. showsTable.put(v1)
  58. seasonsTable.persist()
  59. episodesTable.persist()
  60. showsTable.persist()
  61. console.log('seed status: 7 series (TVmaze 5501, 5502, 5503, 5504, 5505, none, 5506)')

Branches

Latest commits

  • 29a26da9|||PR AP56e: guard hidden show helpers during session syncTracker
  • 7c9ec236|||PR AP56e: re-vendor Hybriel set day56 (source 36ae83a8, bin c1f595a2)Tracker
  • 4b54f6f9Merge branch 'records-audit' into mainTracker
  • cab4a3bc|||PR records: branch audit, PR-onlyTracker
  • 641e1c4cMerge branch 'records-dp71' into mainTracker
  • 85a6e9f5|||PR records: DP71 checked in ChromeTracker
  • f5be5f18records: gitoria PR-only planTracker
  • 46a37036records: DP71 liveTracker
  • 3bcb7039Status/log: DP71 in progressTracker
  • 5b3a5693Log: SR1b merged via PR 2, DP71 startedTracker
  • 783957c2Merge branch 'sr1-search' into mainTracker
  • 792b9652README: search results come from the routeTracker
  • fd8570b1|||PR search: one server exchange per keystrokeTracker
  • e8f5cbcaLog: SR1 result, SR1bTracker
  • 8ad275a4Log/status: tracker 68, SR1Tracker
  • f5a06a0fLog: gitoria push setup, SR1Tracker
  • d6b109baMission SR1mre
  • 608b7558Log: FF1 merged via PR #1mre
  • 2939d94cMerge branch 'ff1-gate-failfast' into mainTracker
  • c934361a|||PR tests: gates fail fast when the app exits during startmre