2022-11-15 15:57:34 +00:00
|
|
|
import * as github from "@actions/github"
|
|
|
|
import { GitHub } from "@actions/github/lib/utils"
|
|
|
|
import anyTest, { TestFn } from "ava" // eslint-disable-line import/no-unresolved
|
2022-11-13 21:35:45 +00:00
|
|
|
|
2022-11-15 15:57:34 +00:00
|
|
|
import * as functions from "../src/functions"
|
2023-06-28 09:03:05 +00:00
|
|
|
import { getReleaseTag, getToken } from "./utils"
|
2022-11-14 03:22:12 +00:00
|
|
|
|
2022-11-14 02:27:54 +00:00
|
|
|
const test = anyTest as TestFn<{
|
|
|
|
token: string
|
|
|
|
octokit: InstanceType<typeof GitHub>
|
|
|
|
}>
|
2022-11-13 21:35:45 +00:00
|
|
|
|
|
|
|
test.before(t => {
|
|
|
|
const first = true
|
|
|
|
const current_token = getToken(first)
|
2022-11-14 02:29:05 +00:00
|
|
|
t.context = {
|
|
|
|
token: current_token,
|
|
|
|
octokit: github.getOctokit(current_token)
|
|
|
|
}
|
2022-11-13 21:35:45 +00:00
|
|
|
})
|
|
|
|
|
2022-11-15 15:57:34 +00:00
|
|
|
test("all_nf_releases", async t => {
|
|
|
|
const result = await functions.all_nf_releases(t.context["octokit"])
|
|
|
|
t.is(typeof result, "object")
|
2022-11-13 21:35:45 +00:00
|
|
|
})
|
2022-11-13 05:00:23 +00:00
|
|
|
|
2022-11-15 15:57:34 +00:00
|
|
|
test("lastest_stable_release_data", async t => {
|
2022-11-13 23:09:09 +00:00
|
|
|
const result = await functions.latest_stable_release_data(
|
2022-11-15 15:57:34 +00:00
|
|
|
t.context["octokit"]
|
2022-11-13 23:09:09 +00:00
|
|
|
)
|
2022-11-15 15:57:34 +00:00
|
|
|
t.is(typeof result, "object")
|
2023-06-28 09:03:05 +00:00
|
|
|
const expected = await getReleaseTag("nextflow-io/nextflow", false)
|
|
|
|
t.is(result["tag_name"], expected)
|
2022-11-13 21:39:14 +00:00
|
|
|
})
|
|
|
|
|
2022-11-15 15:57:34 +00:00
|
|
|
test.todo("nextflow_bin_url")
|
|
|
|
test.todo("install_nextflow")
|