zitadel/test/test.ts

39 lines
1.0 KiB
TypeScript
Raw Normal View History

2024-05-02 10:52:21 +00:00
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 () => {
2024-05-02 12:07:42 +00:00
const user = await testZitadel.listOwnUser();
console.log(user);
2024-05-02 10:52:21 +00:00
})
tap.test('should list users', async () => {
const users = await testZitadel.listUsers();
expect(users).toBeArray();
expect(users[0]).toBeInstanceOf(zitadel.ZitaldelUser);
2024-05-02 12:07:42 +00:00
console.log(users);
2024-05-02 10:52:21 +00:00
})
2024-05-02 12:07:42 +00:00
tap.test('should invite user', async () => {
await testZitadel.createUser({
email: await testQenv.getEnvVarOnDemand('ZITADEL_TEST_EMAIL'),
firstName: 'firstname',
lastName: 'lastname',
})
})
export default tap.start()