26 lines
826 B
TypeScript
26 lines
826 B
TypeScript
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()
|