UNCLASSIFIED

Commit dcd3fee4 authored by graham.smith's avatar graham.smith
Browse files

fix ProjectsSummary

parent aecc5949
...@@ -10,10 +10,12 @@ localVue.use(Vuex); ...@@ -10,10 +10,12 @@ localVue.use(Vuex);
describe("ProjectsSummary", () => { describe("ProjectsSummary", () => {
afterEach(() => { afterEach(() => {
jest.clearAllMocks(); jest.resetAllMocks();
}); });
it("should load component", async () => { it("should load component", () => {
ProjectService.getProjectsSummary = jest.fn();
// render the component // render the component
const wrapper = shallowMount(ProjectsSummary, { const wrapper = shallowMount(ProjectsSummary, {
mocks: { mocks: {
...@@ -32,7 +34,8 @@ describe("ProjectsSummary", () => { ...@@ -32,7 +34,8 @@ describe("ProjectsSummary", () => {
expect(wrapper.find(".error").exists()).toBe(false); expect(wrapper.find(".error").exists()).toBe(false);
}); });
it("should filter by favorited projects", async () => { it("should filter by favorited projects", () => {
ProjectService.getProjectsSummary = jest.fn();
// render the component // render the component
const wrapper = shallowMount(ProjectsSummary, { const wrapper = shallowMount(ProjectsSummary, {
mocks: { mocks: {
...@@ -64,7 +67,7 @@ describe("ProjectsSummary", () => { ...@@ -64,7 +67,7 @@ describe("ProjectsSummary", () => {
]); ]);
}); });
it("should refresh projects", async () => { it("should refresh projects", () => {
ProjectService.getProjectsSummary = jest.fn().mockResolvedValue([ ProjectService.getProjectsSummary = jest.fn().mockResolvedValue([
{ id: "1", links: {}, latestPipeline: {}, favorite: false }, { id: "1", links: {}, latestPipeline: {}, favorite: false },
{ id: "2", links: {}, latestPipeline: {}, favorite: true }, { id: "2", links: {}, latestPipeline: {}, favorite: true },
...@@ -99,7 +102,7 @@ describe("ProjectsSummary", () => { ...@@ -99,7 +102,7 @@ describe("ProjectsSummary", () => {
expect(wrapper.vm.filteredProjects).toEqual([]); expect(wrapper.vm.filteredProjects).toEqual([]);
}); });
it("should refresh with empty projects and trigger empty string", async () => { it("should refresh with empty projects and trigger empty string", () => {
ProjectService.getProjectsSummary = jest.fn().mockResolvedValue([]); ProjectService.getProjectsSummary = jest.fn().mockResolvedValue([]);
// render the component // render the component
const wrapper = shallowMount(ProjectsSummary, { const wrapper = shallowMount(ProjectsSummary, {
...@@ -130,7 +133,7 @@ describe("ProjectsSummary", () => { ...@@ -130,7 +133,7 @@ describe("ProjectsSummary", () => {
expect(wrapper.vm.filteredProjects).toEqual([]); expect(wrapper.vm.filteredProjects).toEqual([]);
}); });
it("should refresh with error", async () => { it("should refresh with error", () => {
ProjectService.getProjectsSummary = jest.fn(); ProjectService.getProjectsSummary = jest.fn();
// render the component // render the component
const wrapper = shallowMount(ProjectsSummary, { const wrapper = shallowMount(ProjectsSummary, {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment