(t *testing.T)
| 40 | } |
| 41 | |
| 42 | func TestProcessVCNoteGenerated(t *testing.T) { |
| 43 | t.Setenv("LARKSUITE_CLI_CONFIG_DIR", t.TempDir()) |
| 44 | |
| 45 | var gotMethod, gotPath string |
| 46 | rt := &stubAPIClient{ |
| 47 | callFn: func(_ context.Context, method, path string, body any) (json.RawMessage, error) { |
| 48 | gotMethod = method |
| 49 | gotPath = path |
| 50 | if body != nil { |
| 51 | t.Fatalf("GET detail body = %#v, want nil", body) |
| 52 | } |
| 53 | return json.RawMessage(`{ |
| 54 | "code": 0, |
| 55 | "msg": "success", |
| 56 | "data": { |
| 57 | "note": { |
| 58 | "artifacts": [ |
| 59 | {"artifact_type": 1, "doc_token": "note_doc_token"}, |
| 60 | {"artifact_type": 2, "doc_token": "verbatim_doc_token"} |
| 61 | ], |
| 62 | "note_source": { |
| 63 | "source_type": "meeting", |
| 64 | "source_entity_id": "6911188411934433028" |
| 65 | } |
| 66 | } |
| 67 | } |
| 68 | }`), nil |
| 69 | }, |
| 70 | } |
| 71 | |
| 72 | out := runNoteGenerated(t, rt, `{ |
| 73 | "schema": "2.0", |
| 74 | "header": { |
| 75 | "event_id": "ev_vc_note_001", |
| 76 | "event_type": "vc.note.generated_v1", |
| 77 | "create_time": "1608725989000" |
| 78 | }, |
| 79 | "event": { |
| 80 | "note_id": "6943848821689040898" |
| 81 | } |
| 82 | }`) |
| 83 | |
| 84 | if gotMethod != "GET" { |
| 85 | t.Errorf("detail method = %q, want GET", gotMethod) |
| 86 | } |
| 87 | if gotPath != "/open-apis/vc/v1/notes/6943848821689040898" { |
| 88 | t.Errorf("detail path = %q", gotPath) |
| 89 | } |
| 90 | if out.Type != eventTypeNoteGenerated { |
| 91 | t.Errorf("Type = %q", out.Type) |
| 92 | } |
| 93 | if out.EventID != "ev_vc_note_001" || out.Timestamp != "1608725989000" { |
| 94 | t.Errorf("EventID/Timestamp = %q/%q", out.EventID, out.Timestamp) |
| 95 | } |
| 96 | if out.NoteID != "6943848821689040898" { |
| 97 | t.Errorf("NoteID = %q", out.NoteID) |
| 98 | } |
| 99 | if out.NoteToken != "note_doc_token" { |
nothing calls this directly
no test coverage detected