tickets
All repositories: gitoria
3.0 KB
// tests/purge94-seed.hl — the fixture of tests/purge94.mjs (mission 028, #94, identity rule): an EMPTY store (TICKETS_STORAGE,// TICKETS_ATTACHMENTS absolute) gets a FAKE project miserit-anthar with 94 tickets (no real data), and on #94: comments with files, an edit,// a comment edit + a comment deletion, a like, an assignment, a state note, relations to and from other tickets (#93 parent, #10 blocker, #30 child,// #50 blocked by it) and a subscription made at #90 (its cursor lies before #94's rows). Control rows live on other tickets and in a second project. Prints one JSON line.import { ensureUser, setUserName, createToken } from '../lib/users.hl'import { createProject, addMember } from '../lib/projects.hl'import { createTicket, addComment, changeComment, editTicket, changeState, assignTicket, setParent, changeBlocker } from '../lib/tickets.hl'import { createSubscription } from '../lib/subscriptions.hl'u = ensureUser('p94alice1')alice = setUserName(u.id, 'alice').userv = ensureUser('p94bob001')bob = setUserName(v.id, 'bob').usermine = createProject(alice, 'miserit-anthar', 'miserit-anthar', 'fixture').projectother = createProject(alice, 'other-proj', 'other-proj', '').projectaddMember(mine.id, bob.id, 'edit')ids = {}let n = 1let sub = nullwhile (n <= 94) {if (n == 90) { sub = createSubscription(alice, { projects = [mine.id] label = 'p94' }) }r = createTicket('miserit-anthar', 'fixture ticket ' + n, 'body of fixture ' + n, alice, '', '')ids['' + n] = r.ticket.idn = n + 1}o1 = createTicket('other-proj', 'other one', 'in the other project', alice, '', '')t94 = ids['94']c1 = addComment(t94, alice, 'first comment on the fixture', [{ name = 'pic.txt' type = 'text/plain' bytes = toBytes('fixture-bytes-one') }])c2 = addComment(t94, bob, 'second comment', [{ name = 'doc.txt' type = 'text/plain' bytes = toBytes('fixture-bytes-two') }])c3 = addComment(t94, alice, 'third comment, to be deleted', [{ name = 'gone.txt' type = 'text/plain' bytes = toBytes('fixture-bytes-three') }])ctl = addComment(ids['5'], alice, 'a control comment', [{ name = 'keep.txt' type = 'text/plain' bytes = toBytes('control-bytes') }])changeComment(t94, c1.event.id, alice, 'edit', 'first comment, edited')changeComment(t94, c2.event.id, alice, 'like', '')changeComment(t94, c3.event.id, alice, 'delete', '')changeComment(ids['5'], ctl.event.id, alice, 'edit', 'control comment, edited')editTicket(t94, alice, 'fixture ticket 94 edited', 'an edited body')assignTicket(t94, alice, 'bob')changeState(t94, 'progress', alice, 'a state note')setParent(t94, alice, 'miserit-anthar#93')changeBlocker(t94, alice, 'miserit-anthar#10', true, '')setParent(ids['30'], alice, 'miserit-anthar#94')changeBlocker(ids['50'], alice, 'miserit-anthar#94', true, '')changeBlocker(ids['51'], alice, 'miserit-anthar#52', true, '')tok = createToken(alice.id, 'p94').tokenout = { alice = alice.id mine = mine.id other = other.id t94 = t94 t93 = ids['93'] t50 = ids['50'] t30 = ids['30'] t5 = ids['5'] t51 = ids['51'] token = tok sub = sub.subscription.id }console.log('SEED ' + JSON.stringify(out))
Branches
Latest commits
- 5d144817Merge branch 'records-t40' into mainTickets
- 44ee6f06|||PR records: #43 #45 livemre
- b8fdeee9Merge branch 'p39-routes' into mainTickets
- a0187a0a|||PR Remove redundant route-order loopmre
- 369e4b9cMerge branch 'k40-lists' into mainTickets
- 9af8e780|||PR Use keyed list mutations for live ticket updatesmre
- 610d8e8aMerge branch 'records-t39' into mainTickets
- 32bcdf24|||PR records: GO P39 K40mre
- 4123c6d1Merge branch 'records-t38' into mainTickets
- cd3641a1|||PR records: day72 deploy live, tickets closedmre
- 7d44d852Merge branch 'records-t37' into mainTickets
- 926f7061|||PR records: merges, D36 deploymre
- bf58534eMerge branch 'l33-final' into mainTickets
- 759a9ac3|||PR thin login (tickets#46, #45): merge main, route entry cleanupmre
- 239436d8Merge remote-tracking branch 'origin/main' into l33-finalmre
- 5822cb3aMerge branch 'o34-clean' into mainTickets
- 0870653c|||PR offline note from __hlOnline, no polling (tickets#41)mre
- 14cf96b4Merge branch 'records-t36' into mainTickets
- 07749fa1|||PR records: day72 + #40 mergedmre
- ecd7e226|||PR Consolidate login and move handler logic into topic libraries (partial)mre