fix(core): update
This commit is contained in:
26
test/test.ts
26
test/test.ts
@ -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()
|
||||
|
Reference in New Issue
Block a user