test: fixed old suites
This commit is contained in:
parent
f88cf3357e
commit
b24f13b9e9
@ -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
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user