39 lines
1.0 KiB
TypeScript
39 lines
1.0 KiB
TypeScript
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(users);
|
|
})
|
|
|
|
tap.test('should invite user', async () => {
|
|
await testZitadel.createUser({
|
|
email: await testQenv.getEnvVarOnDemand('ZITADEL_TEST_EMAIL'),
|
|
firstName: 'firstname',
|
|
lastName: 'lastname',
|
|
})
|
|
})
|
|
|
|
export default tap.start()
|