diff --git a/__tests__/main.test.ts b/__tests__/main.test.ts deleted file mode 100644 index 2223146..0000000 --- a/__tests__/main.test.ts +++ /dev/null @@ -1,51 +0,0 @@ -/** - * Copyright 2020 Google LLC - * - * Licensed under the Apache License, Version 2.0 (the "License"); - * you may not use this file except in compliance with the License. - * You may obtain a copy of the License at - * - * http://www.apache.org/licenses/LICENSE-2.0 - * - * Unless required by applicable law or agreed to in writing, software - * distributed under the License is distributed on an "AS IS" BASIS, - * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. - * See the License for the specific language governing permissions and - * limitations under the License. - */ - -import * as config from "../src/config"; -import * as github from "../src/github"; -import * as secrets from "../src/secrets"; - -// @ts-ignore-next-line -import fixture from "@octokit/fixtures/scenarios/api.github.com/get-repository/normalized-fixture.json"; -import nock from "nock"; -import { run } from "../src/main"; - -nock.disableNetConnect(); - -beforeEach(() => {}); - -test("run should succeed with a repo and secret", async () => { - (github.listAllMatchingRepos as jest.Mock) = jest - .fn() - .mockImplementation(async () => [fixture[0].response]); - - (github.setSecretsForRepo as jest.Mock) = jest - .fn() - .mockImplementation(async () => null); - - (secrets.getSecrets as jest.Mock) = jest.fn().mockReturnValue({ - BAZ: "bar" - }); - - (config.getConfig as jest.Mock) = jest.fn().mockReturnValue({ - GITHUB_TOKEN: "token", - SECRETS: ["BAZ"], - REPOSITORIES: [".*"], - DRY_RUN: false - }); - await run(); - expect(process.exitCode).toBe(undefined); -});