Restructured Changeset Component

WIP
This commit is contained in:
Philipp Czora
2018-09-17 14:03:13 +02:00
parent 2931877c9f
commit 4cb644f9f8
8 changed files with 167 additions and 89 deletions

View File

@@ -5,7 +5,7 @@ import {
FETCH_BRANCHES_FAILURE,
FETCH_BRANCHES_PENDING,
FETCH_BRANCHES_SUCCESS,
fetchBranchesByNamespaceAndName, getBranchesForNamespaceAndNameFromState
fetchBranchesByNamespaceAndName, getBranchesForNamespaceAndNameFromState, getBranchNames
} from "./branches";
import reducer from "./branches";
@@ -128,6 +128,25 @@ describe("branch selectors", () => {
}
}
};
getBranchesForNamespaceAndNameFromState(namespace, name, state);
})
const branches = getBranchesForNamespaceAndNameFromState(namespace, name, state);
expect(branches.length).toEqual(1);
expect(branches[0]).toEqual(branch1);
});
it("should return branches names", () => {
const state = {
branches: {
[key]: {
byNames: {
"branch1": branch1,
"branch2": branch2
}
}
}
};
const names = getBranchNames(namespace, name, state);
expect(names.length).toEqual(2);
expect(names).toContain("branch1");
expect(names).toContain("branch2");
});
});