initial
This commit is contained in:
25
test/test.ts
Normal file
25
test/test.ts
Normal 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()
|
Reference in New Issue
Block a user