Skip to content

Commit

Permalink
test: fixed old suites
Browse files Browse the repository at this point in the history
  • Loading branch information
simonecorsi committed May 9, 2022
1 parent 91f90ae commit feff4b4
Showing 1 changed file with 1 addition and 28 deletions.
29 changes: 1 addition & 28 deletions test/helpers.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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
Expand Down

0 comments on commit feff4b4

Please sign in to comment.