File tree Expand file tree Collapse file tree 5 files changed +514
-2
lines changed
Expand file tree Collapse file tree 5 files changed +514
-2
lines changed Original file line number Diff line number Diff line change 1+ TEST_CLIENT_ID =
2+ TEST_CLIENT_SECRET =
Original file line number Diff line number Diff line change 1+ import { expect , test } from "bun:test"
2+ import { ApiV5Client } from "."
3+ import "dotenv/config"
4+ import { z } from "zod"
5+
6+ test ( "works" , async ( ) => {
7+ const client = new ApiV5Client ( {
8+ apiBase : "api.helloasso.com" ,
9+ clientId : process . env . TEST_CLIENT_ID ! ,
10+ clientSecret : process . env . TEST_CLIENT_SECRET ! ,
11+ logger : ( ) => ( { } ) ,
12+ } )
13+ const result = await client
14+ . call ( "/v5/users/me/organizations" )
15+ . then ( ( r ) => r . json ( ) )
16+ expect (
17+ z
18+ . array (
19+ z . object ( {
20+ name : z . string ( ) ,
21+ role : z . string ( ) ,
22+ city : z . string ( ) ,
23+ zipCode : z . string ( ) ,
24+ updateDate : z . string ( ) ,
25+ url : z . string ( ) . url ( ) ,
26+ organizationSlug : z . string ( ) ,
27+ } )
28+ )
29+ . parse ( result )
30+ ) . toEqual ( result )
31+ } )
You can’t perform that action at this time.
0 commit comments