fix(core): update

This commit is contained in:
2024-02-17 21:55:25 +01:00
parent 332a4a4195
commit 929404fadd
8 changed files with 100 additions and 31 deletions

View File

@ -1,8 +1,28 @@
import { expect, expectAsync, tap } from '@push.rocks/tapbundle';
import * as hetznercloud from '../ts/index.js'
import * as hetznercloud from '../ts/index.js';
import * as qenv from '@push.rocks/qenv';
const testQenv = new qenv.Qenv('./', './.nogit/');
tap.test('first test', async () => {
console.log(hetznercloud)
let testAccount: hetznercloud.HetznerAccount;
tap.test('should create a valid hetzer account', async () => {
testAccount = new hetznercloud.HetznerAccount(await testQenv.getEnvVarOnDemand('HETZNER_API_TOKEN'));
expect(testAccount).toBeInstanceOf(hetznercloud.HetznerAccount);
});
tap.test('should be able to list all servers', async () => {
const servers = await testAccount.getServers();
expect(servers).toBeArray();
console.log(JSON.stringify(servers, null, 2));
})
tap.test('should be able to create a server', async () => {
const newServer = await testAccount.createServer({
name: 'testserver',
location: 'nbg1'
});
expect(newServer).toBeInstanceOf(hetznercloud.HetznerServer);
console.log(newServer);
})
tap.start()