gitoria

tracker

All repositories: gitoria

ReadmeCodePull requestsReleasesTicketsSettings
Commitc6d464e5c6d464e5Log: Apollo GO backlog, AP56 and BS1 startedmrec6d464e5/tests/catalog-entries.hl

2.8 KB

  1. // Representation-independent regression: stable ties, refresh placement, paging and day rollover.
  2. import { index, beginIndex, noteIndexShow, noteIndexEpisode, finishIndex, placeIn, takeOut, rollDay, catalogCounts, pageNumberOf } from '../lib/catalog.hl'
  3. import { todayStr } from '../lib/util.hl'
  4. static idsOf = (&list) => {
  5. out = []
  6. if (list.length == 0) { return out }
  7. if (hlTypeName(list[0]) == 'String') {
  8. for (let i = 0; i < list.length; i = i + 2) { out.push(list[i]) }
  9. } else { for (row of list) { out.push(row.id) } }
  10. return out.join(',')
  11. }
  12. static check = (Boolean ok, String label) => {
  13. if (!ok) { hlError('catalog regression: ' + label) }
  14. console.log('ok ' + label)
  15. }
  16. static place = (&list, String id, String key, Boolean absent) => {
  17. // The old implementation accepts a row; the new implementation accepts separate slots.
  18. if (list.length > 0 && hlTypeName(list[0]) != 'String') { placeIn(&list, { id = id key = key }, absent) }
  19. else { placeIn(&list, &id, &key, absent) }
  20. return null
  21. }
  22. static probe = () => {
  23. beginIndex()
  24. noteIndexShow({ id = 'a' type = 'movie' adult = false release = '2020-01-01' genres = ['g'] })
  25. noteIndexShow({ id = 'b' type = 'movie' adult = false release = '2020-01-01' genres = ['g'] })
  26. noteIndexShow({ id = 'c' type = 'movie' adult = false release = '' genres = ['g'] })
  27. noteIndexShow({ id = 'hidden' type = 'movie' adult = true release = '2030-01-01' genres = ['g'] })
  28. noteIndexShow({ id = 'tv' type = 'series' adult = false release = '1999-01-01' genres = ['g'] })
  29. noteIndexShow({ id = 'tv2' type = 'series' adult = false release = '1999-01-01' genres = ['g'] })
  30. noteIndexEpisode({ show = 'tv' release = '2022-01-01' })
  31. finishIndex()
  32. check(idsOf(&index.movies) == 'a,b,c', 'stable movie ties and missing release')
  33. check(idsOf(&index.series) == 'tv,tv2', 'released TV before unreleased TV')
  34. check(idsOf(&index.genres.g) == 'tv,a,b,tv2,c', 'genre dates and adult filter')
  35. check(catalogCounts().movies == 3 && catalogCounts().series == 2, 'counts are rows')
  36. place(&index.movies, 'a', '2020-01-01', false)
  37. check(idsOf(&index.movies) == 'b,a,c', 'refresh moves equal key after existing ties')
  38. place(&index.movies, 'new', '2030-01-01', true)
  39. takeOut(&index.movies, 'b')
  40. takeOut(&index.movies, 'missing')
  41. check(idsOf(&index.movies) == 'new,a,c', 'new insertion and removal keep id/key alignment')
  42. index.upcoming.tv2 = [todayStr(), '9999-01-01']
  43. index.day = '2000-01-01'
  44. rollDay()
  45. check(idsOf(&index.series) == 'tv2,tv', 'day rollover reorders TV')
  46. check(idsOf(&index.genres.g) == 'tv2,tv,a,b,c', 'day rollover reorders genres')
  47. check(index.upcoming.tv2.length == 1 && index.upcoming.tv2[0] == '9999-01-01', 'day rollover keeps future episodes')
  48. check(pageNumberOf('999999', 3) == 3 && pageNumberOf('nope', 3) == 1 && pageNumberOf('0', 3) == 1, 'page boundaries')
  49. console.log('catalog-entries: passed')
  50. return true
  51. }
  52. probe()

Branches

Latest commits

  • c6d464e5Log: Apollo GO backlog, AP56 and BS1 startedmre
  • 1eb6f1a1Missions AP56, BS1mre
  • 4871f8adLog: AP52 live on day52, browser gate greenmre
  • d9bf2988Merge ap52: day52, tracker#58 server argument, #51 modal close rule, #56 keyed season rowsmre
  • c4a60ef2Log: RT52 retest passed, AP52 startedmre
  • 83760a55Browser gate: search results belong to the address form of the typed text (tracker#52 navigate replace)mre
  • 6e951d91AP52: show-page rows are keyed records; closing a season is one upsert and removes (tracker#56, hybriel#331)mre
  • 3bb4ccddAP52: modal close button refers to its nested rule with Style.buttonModalX (tracker#51, hybriel#333)mre
  • ba16933fAP52: login callback and title route are static handlers taking the server as third argument (tracker#58, hybriel#332)mre
  • 85153900AP52: re-vendor Hybriel set day52 (source 77cfca31, bin 0a8ed496)mre
  • 7c051eddLog: hybriel#338 answermre
  • d049b8b8Log: HM50 live, #52 donemre
  • 6d05fa37Log: HM50 Part A mergedmre
  • 1c7dab74HM50: the shell reads the framework's online state, netProbe removed (tracker#55)mre
  • e8b91697HM50: search address follows the text via navigate(path, replace = true) (tracker#52)mre
  • 6fe1896cHM50: re-vendor Hybriel set day50 (source 0ae38232, bin d3ef9d16)mre
  • 2f391aa9Log: HM50 startedmre
  • 4b59c03dHM50 mission: doc pathmre
  • ed526d67HM50 missionmre
  • 2f986ca3Log: RT50 passmre