import { expect, expectAsync, tap } from '@push.rocks/tapbundle'; import * as qenv from '@push.rocks/qenv'; const testQenv = new qenv.Qenv('./', './.nogit/'); import * as zitadel from '../ts/index.js' import test from 'node:test'; let testZitadel: zitadel.ZitaldelClient; tap.test('first test', async () => { testZitadel = new zitadel.ZitaldelClient({ url: await testQenv.getEnvVarOnDemand('ZITADEL_URL'), accessToken: await testQenv.getEnvVarOnDemand('ZITADEL_TOKEN') }); }); tap.test('should list own user', async () => { const user = await testZitadel.listOwnUser(); console.log(user); }) tap.test('should list users', async () => { const users = await testZitadel.listUsers(); expect(users).toBeArray(); expect(users[0]).toBeInstanceOf(zitadel.ZitaldelUser); console.log(JSON.stringify(users, null, 2)); }) const createUserTest = tap.test('should invite user', async (toolsArg) => { const user = await testZitadel.createUser({ email: await testQenv.getEnvVarOnDemand('ZITADEL_TEST_EMAIL'), firstName: 'firstname', lastName: 'lastname', }) await toolsArg.delayFor(5000); return user; }) tap.test('should delete user', async () => { const createdUser: zitadel.ZitaldelUser = (await createUserTest.testResultPromise) as any; expect(createdUser).toBeInstanceOf(zitadel.ZitaldelUser); await createdUser.delete(); }) export default tap.start()