Skip to content
This repository was archived by the owner on Jan 5, 2024. It is now read-only.

Commit dfe236d

Browse files
author
Jared Weakly
committed
Make updating tests on version bumps unnecessary
1 parent 54cfeed commit dfe236d

File tree

1 file changed

+10
-7
lines changed

1 file changed

+10
-7
lines changed

__tests__/find-haskell.test.ts

Lines changed: 10 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ import {getInput} from '@actions/core';
33
import * as supported_versions from '../src/versions.json';
44

55
const def = getDefaults();
6+
const latestVersions = {
7+
ghc: supported_versions.ghc[0],
8+
cabal: supported_versions.cabal[0],
9+
stack: supported_versions.stack[0]
10+
};
611

712
const mkName = (s: string): string =>
813
`INPUT_${s.replace(/ /g, '_').toUpperCase()}`;
@@ -25,8 +30,7 @@ describe('actions/setup-haskell', () => {
2530
afterEach(() => (process.env = OLD_ENV));
2631

2732
it('Parses action.yml to get correct default versions', () => {
28-
const defs = {ghc: '8.10.1', cabal: '3.2.0.0', stack: '2.1.3'};
29-
forAll(t => expect(def[t].version).toBe(defs[t]));
33+
forAll(t => expect(def[t].version).toBe(latestVersions[t]));
3034
});
3135

3236
it('Supported versions are parsed from JSON correctly', () =>
@@ -56,14 +60,13 @@ describe('actions/setup-haskell', () => {
5660
});
5761

5862
it('"latest" Versions resolve correctly', () => {
59-
const v = {ghc: '8.6.5', cabal: '2.4.1.0', stack: '2.1.3'};
6063
setupEnv({
61-
'stack-version': '2.1',
62-
'ghc-version': '8.6',
63-
'cabal-version': '2.4'
64+
'stack-version': 'latest',
65+
'ghc-version': 'latest',
66+
'cabal-version': 'latest'
6467
});
6568
const options = getOpts(def);
66-
forAll(t => expect(options[t].resolved).toBe(v[t]));
69+
forAll(t => expect(options[t].resolved).toBe(latestVersions[t]));
6770
});
6871

6972
it('Enabling stack does not disable GHC or Cabal', () => {

0 commit comments

Comments
 (0)