Permalink
Cannot retrieve contributors at this time
29 lines (21 sloc)
795 Bytes
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
labeler/__tests__/labeler.test.ts
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import { checkGlobs } from '../src/labeler' | |
import * as core from "@actions/core"; | |
jest.mock("@actions/core"); | |
beforeAll(() => { | |
jest.spyOn(core, "getInput").mockImplementation((name, options) => { | |
return jest.requireActual("@actions/core").getInput(name, options); | |
}); | |
}); | |
const matchConfig = [{ any: ["*.txt"] }]; | |
describe('checkGlobs', () => { | |
it('returns true when our pattern does match changed files', () => { | |
const changedFiles = ["foo.txt", "bar.txt"]; | |
const result = checkGlobs(changedFiles, matchConfig); | |
expect(result).toBeTruthy(); | |
}); | |
it('returns false when our pattern does not match changed files', () => { | |
const changedFiles = ["foo.docx"]; | |
const result = checkGlobs(changedFiles, matchConfig); | |
expect(result).toBeFalsy(); | |
}); | |
}); |