test: fixed old suites

This commit is contained in:
Simone Corsi 2022-05-09 17:22:12 +02:00
parent f88cf3357e
commit b24f13b9e9
No known key found for this signature in database
GPG Key ID: 0F5535005610947A

View File

@ -5,16 +5,6 @@ import fs from 'fs';
import * as core from '@actions/core';
sinon.replace(core, 'getInput', sinon.fake());
import GithubApi from '../src/api';
const GithubApiFake = sinon.fake((rul) => ({
body: [],
headers: {
link:
'<https://api.github.com/user/5617452/starred?page=2>; rel="next", <https://api.github.com/user/5617452/starred?page=2>; rel="last"',
},
}));
sinon.replace(GithubApi, 'get', GithubApiFake);
import Git from '../src/git';
const pull = sinon.fake();
sinon.replace(Git, 'pull', pull);
@ -31,30 +21,13 @@ const fsp = fs.promises;
const writeFile = sinon.fake();
sinon.replace(fsp, 'writeFile', writeFile);
import {
wait,
renderer,
apiGetStar,
generateMd,
pushNewFiles,
} from '../src/helpers';
test('wait should wait', async (t) => {
await wait(200);
t.pass();
});
import { renderer, generateMd, pushNewFiles } from '../src/helpers';
test('renderer should render', async (t) => {
const output = await renderer({ variable: 123 }, 'Test: <%= variable %>');
t.is(output, 'Test: 123');
});
test('apiGetStar', async (t) => {
let stars = await apiGetStar('url');
t.true(GithubApiFake.called);
t.true(Array.isArray(stars));
});
test('generateMd should create TOC', async (t) => {
const tpl = `# title