oficina / equipo Public

Clone
git clone https://amadan.net/oficina/equipo

Plain git — no account needed to clone.

Download

Download this file

1package chat
2
3import (
4 "context"
5 "testing"
6
7 "amadan.net/oficina/equipo/internal/wire"
8)
9
10// With building off, a held job's steps are refused their start, a
11// Preview rebuilt on its finished task included; only its Publish (going
12// live) isn't (Astra phase 2 round 3, P1).
13func TestStepHeldSparesOnlyPublish(t *testing.T) {
14 h, base := boardBase(t)
15 refresh(t, h)
16 for _, r := range []any{
17 &handoffRecord{ID: "h_p", Person: abPerson, State: handoffOpen, LedgerKey: "k-p", CreatedAt: h.now(), UpdatedAt: h.now()},
18 &handoffTaskRecord{HandoffID: "h_p", TaskID: "tk_done", Created: true},
19 } {
20 if err := h.s.db.G.Create(r).Error; err != nil {
21 t.Fatal(err)
22 }
23 }
24 base.set(func(f *fakeBoardBase) { f.board.Abilities["build"], f.board.Revision = false, 2 })
25 refresh(t, h)
26 held := func(specialist string) bool {
27 var out bool
28 if err := h.s.tx(context.Background(), func(tx *txn) error {
29 var err error
30 out, err = tx.stepHeld(stepRecord{ID: "s_" + specialist, TaskID: "tk_done", Specialist: specialist})
31 return err
32 }); err != nil {
33 t.Fatal(err)
34 }
35 return out
36 }
37 if !held(wire.SpecialistPreview) {
38 t.Error("a Preview rebuilt with building off wasn't held")
39 }
40 if held(wire.SpecialistPublish) {
41 t.Error("a Publish was held for building")
42 }
43}
44