metadata-action/__tests__/github.test.ts

17 lines
492 B
TypeScript
Raw Normal View History

2020-10-25 02:25:23 +01:00
import * as path from 'path';
import * as github from '../src/github';
jest.spyOn(github, 'repo').mockImplementation(
(): Promise<github.ReposGetResponseData> => {
return <Promise<github.ReposGetResponseData>>require(path.join(__dirname, 'fixtures', 'repo.json'));
2020-10-25 02:25:23 +01:00
}
);
describe('repo', () => {
it('returns GitHub repository', async () => {
const repo = await github.repo(process.env.GITHUB_TOKEN || '');
console.log(repo);
expect(repo.name).not.toBeNull();
});
});