diff --git a/test/functions.ts b/test/functions.ts index c7c443c..8b78a1a 100644 --- a/test/functions.ts +++ b/test/functions.ts @@ -21,16 +21,17 @@ function nf_release_gen(version_number: string): NextflowRelease { } // A mock set of Nextflow releases -const edge_is_newer = [ - nf_release_gen("v23.09.1-edge"), - nf_release_gen("v23.04.3"), - nf_release_gen("v23.04.2") -] -const edge_is_older = [ - nf_release_gen("v23.04.3"), - nf_release_gen("v23.04.2"), - nf_release_gen("v23.03.0-edge") -] +async function* edge_is_newer(): AsyncGenerator { + yield nf_release_gen("v23.09.1-edge") + yield nf_release_gen("v23.04.3") + yield nf_release_gen("v23.04.2") +} + +async function* edge_is_older(): AsyncGenerator { + yield nf_release_gen("v23.04.3") + yield nf_release_gen("v23.04.2") + yield nf_release_gen("v23.03.0-edge") +} /* The whole reason this action exists is to handle the cases where a final @@ -44,7 +45,7 @@ const release_filter_macro = test.macro( t, input_version: string, expected_version: string, - releases: NextflowRelease[] + releases: AsyncGenerator ) => { const matched_release = await functions.get_nextflow_release( input_version, @@ -58,56 +59,56 @@ test( release_filter_macro, "latest-everything", "v23.09.1-edge", - edge_is_newer + edge_is_newer() ) test( "Latest-everything install with older edge release", release_filter_macro, "latest-everything", "v23.04.3", - edge_is_older + edge_is_older() ) test( "Latest-edge install with newer edge release", release_filter_macro, "latest-edge", "v23.09.1-edge", - edge_is_newer + edge_is_newer() ) test( "Latest-edge install with older edge release", release_filter_macro, "latest-edge", "v23.03.0-edge", - edge_is_older + edge_is_older() ) test( "Latest-stable install with newer edge release", release_filter_macro, "latest", "v23.04.3", - edge_is_newer + edge_is_newer() ) test( "Latest-stable install with older edge release", release_filter_macro, "latest", "v23.04.3", - edge_is_older + edge_is_older() ) test( "Fully versioned tag release", release_filter_macro, "v23.04.2", "v23.04.2", - edge_is_newer + edge_is_newer() ) test( "Partially versioned tag release", release_filter_macro, "v23.04", "v23.04.3", - edge_is_newer + edge_is_newer() ) test.todo("install_nextflow") diff --git a/test/releasedata.ts b/test/releasedata.ts index 6428294..7a90ad7 100644 --- a/test/releasedata.ts +++ b/test/releasedata.ts @@ -2,8 +2,11 @@ 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 { nextflow_bin_url } from "../src/nextflow-release" -import { all_nf_release_data } from "../src/octokit-wrapper" +import { NextflowRelease } from "../src/nextflow-release" +import { + pull_latest_stable_release, + pull_releases +} from "../src/octokit-wrapper" import { getToken } from "./utils" const test = anyTest as TestFn<{