import { expect, tap } from '@push.rocks/tapbundle'; import * as medium from '../ts/index.js'; import {Qenv} from '@push.rocks/qenv'; const testQenv = new Qenv('./', './.nogit/'); let testMediumAccount: medium.MediumAccount; tap.test('first test', async () => { testMediumAccount = new medium.MediumAccount(await testQenv.getEnvVarOnDemand('MEDIUM_API_TOKEN')); expect(testMediumAccount).toBeInstanceOf(medium.MediumAccount); }); tap.test('should get me info', async () => { const result = await testMediumAccount.getAccountInfo(); console.log(result); }); tap.test('should get publications', async () => { const result = await testMediumAccount.getAllPublications(); // console.log(result); }); tap.test('should get own publications', async () => { const result = await testMediumAccount.getOwnPublications(); // 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: '

hello So awesome', publishStatus: 'draft', tags: [] }); console.log(newPost); }) tap.start();