chore: Clean up typing in tests

This commit is contained in:
Edmund Miller 2022-11-13 20:27:54 -06:00 committed by Thomas A. Christensen II
parent c3424c52c4
commit 7c79f790e0
2 changed files with 12 additions and 6 deletions

View file

@ -1,15 +1,18 @@
import * as functions from '../src/functions' import * as functions from '../src/functions'
import {getToken} from './utils' import {getToken} from './utils'
import * as github from '@actions/github' import * as github from '@actions/github'
import {GitHub} from '@actions/github/lib/utils'
import anyTest, {TestFn} from 'ava' // eslint-disable-line import/no-unresolved import anyTest, {TestFn} from 'ava' // eslint-disable-line import/no-unresolved
const test = anyTest as TestFn<{foo: string}> const test = anyTest as TestFn<{
token: string
octokit: InstanceType<typeof GitHub>
}>
test.before(t => { test.before(t => {
const first = true const first = true
const current_token = getToken(first) const current_token = getToken(first)
t.context = {token: current_token} t.context = {token: current_token, octokit: github.getOctokit(current_token)}
t.context = {octokit: github.getOctokit(current_token)}
}) })
test('all_nf_releases', async t => { test('all_nf_releases', async t => {

View file

@ -1,15 +1,18 @@
import * as github from '@actions/github' import * as github from '@actions/github'
import {release_data} from '../src/functions' import {release_data} from '../src/functions'
import {getToken} from './utils' import {getToken} from './utils'
import {GitHub} from '@actions/github/lib/utils'
import anyTest, {TestFn} from 'ava' // eslint-disable-line import/no-unresolved import anyTest, {TestFn} from 'ava' // eslint-disable-line import/no-unresolved
const test = anyTest as TestFn<{foo: string}> const test = anyTest as TestFn<{
token: string
octokit: InstanceType<typeof GitHub>
}>
test.before(t => { test.before(t => {
const first = true const first = true
const current_token = getToken(first) const current_token = getToken(first)
t.context = {token: current_token} t.context = {token: current_token, octokit: github.getOctokit(current_token)}
t.context = {octokit: github.getOctokit(current_token)}
}) })
const macro = test.macro(async (t, version: string, expected: string) => { const macro = test.macro(async (t, version: string, expected: string) => {