Skip to content

Instantly share code, notes, and snippets.

@lmiller1990
Created July 24, 2018 04:41
Show Gist options
  • Save lmiller1990/af6128bf4811e6f26532e237f6d4bc92 to your computer and use it in GitHub Desktop.
Save lmiller1990/af6128bf4811e6f26532e237f6d4bc92 to your computer and use it in GitHub Desktop.
// ...
import NestedRoute from "@/compoents/NestedRoute.vue"
import mockModule from "@/bust-cache.js"
jest.mock("@/bust-cache.js", () => ({ bustCache: jest.fn() }))
it("calls bustCache and next when leaving the route", () => {
const next = jest.fn()
NestedRoute.beforeRouteLeave(undefined, undefined, next)
expect(mockModule.bustCache).toHaveBeenCalled()
expect(next).toHaveBeenCalled()
})
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment