From 0041d7fa413e237c664c76f578de797f567f2de7 Mon Sep 17 00:00:00 2001 From: Federico Builes Date: Thu, 6 Apr 2023 16:21:52 +0200 Subject: [PATCH] Add a failing test. --- __tests__/config.test.ts | 6 +++--- __tests__/external-config.test.ts | 24 ++++++++++++++++++++++-- 2 files changed, 25 insertions(+), 5 deletions(-) diff --git a/__tests__/config.test.ts b/__tests__/config.test.ts index 6c892a8..0d2ed14 100644 --- a/__tests__/config.test.ts +++ b/__tests__/config.test.ts @@ -1,6 +1,6 @@ -import { expect, test, beforeEach } from '@jest/globals' -import { readConfig } from '../src/config' -import { getRefs } from '../src/git-refs' +import {expect, test, beforeEach} from '@jest/globals' +import {readConfig} from '../src/config' +import {getRefs} from '../src/git-refs' import * as Utils from '../src/utils' // GitHub Action inputs come in the form of environment variables diff --git a/__tests__/external-config.test.ts b/__tests__/external-config.test.ts index 02e7f47..c4f3029 100644 --- a/__tests__/external-config.test.ts +++ b/__tests__/external-config.test.ts @@ -1,5 +1,5 @@ -import { expect, test, beforeEach } from '@jest/globals' -import { readConfig } from '../src/config' +import {expect, test, beforeEach} from '@jest/globals' +import {readConfig} from '../src/config' import * as Utils from '../src/utils' // GitHub Action inputs come in the form of environment variables @@ -102,3 +102,23 @@ test('it supports comma-separated lists', async () => { expect(config.allow_licenses).toEqual(['MIT', 'GPL-2.0-only']) }) + +test('it reads a config file hosted in another repo', async () => { + setInput( + 'config-file', + 'future-funk/anyone-cualkiera/external-config.yml@main' + ) + setInput('external-repo-token', 'gh_viptoken') + + setInput( + 'config-file', + 'future-funk/anyone-cualkiera/external-config.yml@main' + ) + + setInput('external-repo-token', 'gh_viptoken') + + const config = await Config.readConfig() + + expect(config.fail_on_severity).toEqual('critical') + expect(config.allow_licenses).toEqual(['BSD', 'GPL 2']) +})