oficina / equipo Public

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

Plain git — no account needed to clone.

Download

Download this file

1package equipo
2
3import (
4 "context"
5 "testing"
6
7 "amadan.net/oficina/equipo/internal/equipo/team"
8 "amadan.net/oficina/equipo/internal/runnerproto"
9)
10
11func TestRunnerReceiptBindsSelection(t *testing.T) {
12 a := Assignment{ID: "assignment", Selection: runnerproto.Selection{Provider: "claude", Model: "assigned-model"}}
13 for _, field := range []string{"provider", "model", "matching"} {
14 t.Run(field, func(t *testing.T) {
15 r := team.Receipt{ID: "receipt", Outcome: team.OutcomeSuccess, Provider: a.Selection.Provider, Model: a.Selection.Model}
16 if field == "provider" {
17 r.Provider = "other"
18 }
19 if field == "model" {
20 r.Model = "other"
21 }
22 got, err := instanceValidators().Receipt(context.Background(), a, RunnerRequest{AssignmentID: a.ID, Receipt: &r})
23 if field == "matching" {
24 if err != nil || got.Model != r.Model || got.Provider != r.Provider {
25 t.Fatal(got, err)
26 }
27 } else if err == nil {
28 t.Fatal("receipt accepted mismatched", field)
29 }
30 })
31 }
32}
33