github.com/runapi-ai/core-sdk/go v0.2.7
imports encoding/jsonCopy data via io.Copy
SHA-2566918682c49fc337e12bb4bff6542f50bc4007bc1a50813e424d4d716ad64a108
MaleculeH₂(Cm₃F)
Evidence
1package account
2
3import (
4 "context"
5 "encoding/json"
6 "testing"
7
8 "github.com/runapi-ai/core-sdk/go/core"
9)
10
⋯6 lines
19:16… wMessage(`{"id":1,"name":"test","email":"[email protected]","account":{"id":2,"name":"acme"}}`), nil
20}
21
22func TestInfoSendsCorrectRequest(t *testing.T) {
23 stub := &stubHTTPClient{}
24 client := NewClientWithHTTP(stub)
25 resp, err := client.Info(context.Background())
26 if err != nil {
27 t.Fatal(err)
28 }
29 if stub.method != "GET" || stub.path != "/api/v1/me" {
30 t.Fatalf("unexpected request: %s %s", stub.method, stub.path) …
59:5… Fatalf("unexpected request: %s %s", stub.method, stub.path)
60 }
61 if resp.BalanceCents != 5000 {
62 t.Fatalf("unexpected balance: %d", resp.BalanceCents)
63 }
64 if resp.SpentCentsToday != 100 {
65 t.Fatalf("unexpected spent today: %d", resp.SpentCentsToday)
66 }
67 if resp.PaidBalanceCents != 4000 {
68 t.Fatalf("unexpected paid balance: %d", resp.PaidBalanceCents)
69 }
70 if resp.BonusBalanceCents != 1000 {
71 t.Fatalf("unexpected bonus balance: %d", resp.BonusBalanceCents)
72 }
73}
⋯6 lines
10 "mime/multipart"
11 "net"
12 "net/http"
13 "net/textproto"
14 "net/url"
15 "os"
179 req, err := http.NewRequestWithContext(ctx, method, fullURL, requestBody)
180 if err != nil {
181 if closer, ok := requestBody.(io.Closer); ok {
182 _ = closer.Close()
No evidence locations were recorded for this file. Raw result