import { WorkOS, WorkOSClient } from "../src"; import { createHmacOverrideAsync } from "../src/core"; describe("WorkOS Client", () => { it.skip("list auth factors", async () => { const client = new WorkOSClient({ authorizationToken: "...", }); const page = await client.userManagement.listAuthFactors("user_01HNKS1ZR3E42WMGAV48N1R21Z", { order: "asc", limit: 1, }); for await (const factor of page) { console.log(factor); } }); it.skip("create organization", async () => { const client = new WorkOSClient({ authorizationToken: "...", }); const org: WorkOS.Organization = await client.organizations.create({ allowProfilesOutsideOrganization: true, name: "My Organization", }); expect(org).toBeDefined(); }); it.skip("create organization", async () => { const client = new WorkOSClient({ authorizationToken: "...", }); const connection: WorkOS.Connection = { object: "connection", id: "conneciton_id", connectionType: WorkOS.ConnectionType.AzureSaml, name: "test connection", state: WorkOS.ConnectionState.Active, status: WorkOS.ConnectionStatus.Linked, domains: [], createdAt: new Date(), updatedAt: new Date(), } const testConnectionActivatedEvent = { id: "id", event: "connection.activated", data: connection } const secret = "test_secret" const timestamp = Date.now() const signature = await createHmacOverrideAsync( `${timestamp}.${JSON.stringify(testConnectionActivatedEvent)}`, secret ) const header = [ 't=' + timestamp, "sha256" + '=' + signature, ].join(','); client.webhooks.constructEvent( testConnectionActivatedEvent, header, secret ) }); });