fix tests for core plugins

This commit is contained in:
Sebastian Sdorra
2019-10-09 11:22:16 +02:00
parent d7e62fadb0
commit 9a56ea50e7
13 changed files with 87 additions and 18 deletions

View File

@@ -14,7 +14,7 @@ import RepositoryConfig from "./RepositoryConfig";
// @visibleForTesting
export const gitPredicate = (props: Object) => {
return props.repository && props.repository.type === "git";
return !!(props && props.repository && props.repository.type === "git");
};
binder.bind(

View File

@@ -1,7 +1,7 @@
// @flow
import { gitPredicate } from "./index";
describe("test gi predicate", () => {
describe("test git predicate", () => {
it("should return false", () => {
expect(gitPredicate()).toBe(false);
expect(gitPredicate({})).toBe(false);
@@ -10,6 +10,6 @@ describe("test gi predicate", () => {
});
it("should return true", () => {
expect(gitPredicate({ repository: { type: "fir" } })).toBe(true);
expect(gitPredicate({ repository: { type: "git" } })).toBe(true);
});
});