fix(core): Fixed module name inconsistencies and documentation links

This commit is contained in:
2024-07-01 16:43:21 +02:00
parent 2499578bb1
commit 46c235b82b
18 changed files with 7137 additions and 236 deletions

View File

@ -1,23 +1,23 @@
import { expect, tap } from '@pushrocks/tapbundle';
import * as medium from '../ts/index';
import { expect, tap } from '@push.rocks/tapbundle';
import * as medium from '../ts/index.js';
import {Qenv} from '@pushrocks/qenv';
import {Qenv} from '@push.rocks/qenv';
const testQenv = new Qenv('./', './.nogit/');
let testMediumAccount: medium.MediumAccount;
tap.test('first test', async () => {
testMediumAccount = new medium.MediumAccount(testQenv.getEnvVarOnDemand('MEDIUM_API_TOKEN'));
expect(testMediumAccount).to.be.instanceOf(medium.MediumAccount);
expect(testMediumAccount).toBeInstanceOf(medium.MediumAccount);
});
tap.test('should get me info', async () => {
const result = await testMediumAccount.getAccountInfo();
// console.log(result);
console.log(result);
});
tap.test('should get publications', async () => {
const result = await testMediumAccount.getPublications();
const result = await testMediumAccount.getAllPublications();
// console.log(result);
});
@ -26,4 +26,22 @@ tap.test('should get own publications', async () => {
// console.log(result);
});
tap.test('should get a publication by name', async () => {
const result = await testMediumAccount.getPublicationByName('mojoio-test');
console.log(result);
});
tap.test('should create a post', async () => {
const mojoioTestPublication = await testMediumAccount.getPublicationByName('mojoio-test');
const newPost = await mojoioTestPublication.createPost({
title: 'a test title',
contentFormat: 'html',
canonicalUrl: 'https://mojo.io/testarticle',
content: '<h1>hello</1> So awesome',
publishStatus: 'draft',
tags: []
});
console.log(newPost);
})
tap.start();