This commit is contained in:
2024-07-01 16:32:22 +02:00
commit 3fb6e3b3c3
16 changed files with 7389 additions and 0 deletions

25
test/test.ts Normal file
View File

@ -0,0 +1,25 @@
import { expect, expectAsync, tap } from '@push.rocks/tapbundle';
import * as qenv from '@push.rocks/qenv';
const testQenv = new qenv.Qenv('./', './.nogit/');
import * as ghost from '../ts/index.js'
let testGhostInstance: ghost.Ghost;
tap.test('should create a valid instance of Ghost', async () => {
testGhostInstance = new ghost.Ghost({
baseUrl: 'https://coffee.link',
adminApiKey: await testQenv.getEnvVarOnDemand('ADMIN_APIKEY'),
contentApiKey: await testQenv.getEnvVarOnDemand('CONTENT_APIKEY'),
});
expect(testGhostInstance).toBeInstanceOf(ghost.Ghost);
});
tap.test('should get posts', async () => {
const posts = await testGhostInstance.getPosts();
expect(posts).toBeArray();
expect(posts[0]).toBeInstanceOf(ghost.Post);
console.log(posts.map((post) => post.getTitle()));
})
tap.start()