Skip to content

Commit

Permalink
refactor(test): extract function to run git handler tests
Browse files Browse the repository at this point in the history
  • Loading branch information
vvagaytsev committed Dec 4, 2023
1 parent 75a91ba commit b028a1c
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
5 changes: 2 additions & 3 deletions core/test/unit/src/vcs/git-repo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,8 @@
* file, You can obtain one at http://mozilla.org/MPL/2.0/.
*/

import { commonGitHandlerTests, getTreeVersionTests } from "./git.js"
import { runGitHandlerTests } from "./git.js"

describe("GitRepoHandler", () => {
commonGitHandlerTests("repo")
getTreeVersionTests("repo")
runGitHandlerTests("repo")
})
12 changes: 8 additions & 4 deletions core/test/unit/src/vcs/git.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ function getGitHandlerCls(gitScanMode: GitScanMode): GitHandlerCls {
}
}

export const commonGitHandlerTests = (gitScanMode: GitScanMode) => {
const commonGitHandlerTests = (gitScanMode: GitScanMode) => {
let garden: TestGarden
let tmpDir: tmp.DirectoryResult
let tmpPath: string
Expand Down Expand Up @@ -1284,7 +1284,7 @@ export const commonGitHandlerTests = (gitScanMode: GitScanMode) => {
})
}

export const getTreeVersionTests = (gitScanMode: GitScanMode) => {
const getTreeVersionTests = (gitScanMode: GitScanMode) => {
const gitHandlerCls = getGitHandlerCls(gitScanMode)
describe("getTreeVersion", () => {
context("include and exclude filters", () => {
Expand Down Expand Up @@ -1358,9 +1358,13 @@ export const getTreeVersionTests = (gitScanMode: GitScanMode) => {
})
}

export function runGitHandlerTests(gitScanMode: GitScanMode) {
commonGitHandlerTests(gitScanMode)
getTreeVersionTests(gitScanMode)
}

describe("GitHandler", () => {
commonGitHandlerTests("subtree")
getTreeVersionTests("subtree")
runGitHandlerTests("subtree")
})

describe("git", () => {
Expand Down

0 comments on commit b028a1c

Please sign in to comment.