From 12f7fc1a8b37fe4d548a9e127ff1ea0284c0870d Mon Sep 17 00:00:00 2001 From: Sven-Hendrik Haase Date: Thu, 2 Jul 2020 09:46:02 +0200 Subject: [PATCH] Add stub tests --- __tests__/main.test.ts | 21 ++++++++++++++++++++- 1 file changed, 20 insertions(+), 1 deletion(-) diff --git a/__tests__/main.test.ts b/__tests__/main.test.ts index 92e7c18..3840165 100644 --- a/__tests__/main.test.ts +++ b/__tests__/main.test.ts @@ -1,6 +1,25 @@ +import * as github from '@actions/github' import * as main from '../src/main' // Frankly, tests would be entirely useless unless we can mock GitHub somehow. describe('Upload Release Action', () => { - it('', async () => {}) + let spyGetOctokit: jest.SpyInstance + let mockOctokit: any + + beforeEach(() => { + mockOctokit = { + repos: { + createRelease: jest.fn(async () => ({ + data: { + id: 'lalala', + upload_url: 'oaoa' + } + })) + } + } + // spyGetOctokit = jest.spyOn(github, "getOctokit").mockImplementation(() => mockOctokit + // jest.spyOn(github, "context", "get").mockImplementation(() => "testtest"); + }) + + it('pls write actual test', async () => {}) })