mirror of
https://github.com/MillironX/setup-nextflow.git
synced 2024-11-21 17:36:04 +00:00
test: Update API consistency tests
This commit is contained in:
parent
670f4c751c
commit
85718639f5
1 changed files with 20 additions and 19 deletions
|
@ -2,8 +2,9 @@ import * as github from "@actions/github"
|
||||||
import { GitHub } from "@actions/github/lib/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
|
||||||
|
|
||||||
import { release_data } from "../src/functions"
|
import { nextflow_bin_url } from "../src/NextflowRelease"
|
||||||
import { getReleaseTag, getToken } from "./utils"
|
import { all_nf_release_data } from "../src/OctokitWrapper"
|
||||||
|
import { getToken } from "./utils"
|
||||||
|
|
||||||
const test = anyTest as TestFn<{
|
const test = anyTest as TestFn<{
|
||||||
token: string
|
token: string
|
||||||
|
@ -19,22 +20,22 @@ test.before(t => {
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
const macro = test.macro(async (t, version: string) => {
|
const exists_macro = test.macro(async (t, object_name: string) => {
|
||||||
let expected
|
const all_releases = await all_nf_release_data(t.context.octokit)
|
||||||
if (version === "latest-stable") {
|
const first_release = all_releases[0]
|
||||||
expected = await getReleaseTag("nextflow-io/nextflow", false)
|
t.assert(first_release.hasOwnProperty(object_name))
|
||||||
} else if (version === "latest-edge") {
|
|
||||||
expected = await getReleaseTag("nextflow-io/nextflow", true)
|
|
||||||
} else if (version === "latest-everything") {
|
|
||||||
expected = await getReleaseTag("nextflow-io/nextflow", undefined)
|
|
||||||
} else {
|
|
||||||
expected = version
|
|
||||||
}
|
|
||||||
const result = await release_data(version, t.context["octokit"])
|
|
||||||
t.is(result["tag_name"], expected)
|
|
||||||
})
|
})
|
||||||
|
|
||||||
test("hard version", macro, "v22.10.2")
|
test("OctoKit returns tag", exists_macro, "tag_name")
|
||||||
test("latest-stable", macro, "latest-stable")
|
test("Octokit returns prerelease", exists_macro, "prerelease")
|
||||||
test("latest-edge", macro, "latest-edge")
|
test("Octokit returns assets", exists_macro, "assets")
|
||||||
test("latest-everything", macro, "latest-everything")
|
|
||||||
|
const binary_url_macro = test.macro(async (t, get_all: boolean) => {
|
||||||
|
const all_releases = await all_nf_release_data(t.context.octokit)
|
||||||
|
const first_release = all_releases[0]
|
||||||
|
const url = nextflow_bin_url(first_release, get_all)
|
||||||
|
t.notThrows(() => new URL(url))
|
||||||
|
})
|
||||||
|
|
||||||
|
test("Nextflow binary URL valid", binary_url_macro, false)
|
||||||
|
test("Nextflow 'all' binary URL valid", binary_url_macro, true)
|
||||||
|
|
Loading…
Reference in a new issue