import { expect, expectAsync, tap } from '@push.rocks/tapbundle'; import * as hetznercloud from '../ts/index.js'; import * as qenv from '@push.rocks/qenv'; const testQenv = new qenv.Qenv('./', './.nogit/'); 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()