Skip to content
This repository has been archived by the owner on Sep 12, 2023. It is now read-only.

Commit

Permalink
unit(component): mock provide on other test cases
Browse files Browse the repository at this point in the history
  • Loading branch information
lemredd committed Nov 22, 2022
1 parent f3f6413 commit b30efd6
Showing 1 changed file with 50 additions and 3 deletions.
53 changes: 50 additions & 3 deletions components/authentication/log_in_form.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,23 @@ describe("Component: Log In Form", () => {
}),
{ "status": RequestEnvironment.status.OK })

const wrapper = shallowMount(Component)
const listOfAdminEmails = [
"sample1@email.com",
"sample2@email.com",
"sample3@email.com"
]

const wrapper = shallowMount(Component, {
"global": {
"provide": {
"pageContext": {
"pageProps": {
listOfAdminEmails
}
}
}
}
})
const emailField = wrapper.findComponent({ "name": "TextualField" })
const passwordField = wrapper.findComponent({ "name": "PasswordField" })
const submitBtn = wrapper.find(".submit-btn")
Expand All @@ -41,7 +57,22 @@ describe("Component: Log In Form", () => {
})

it("should show error from authentication-guarded route", () => {
const wrapper = shallowMount<any>(Component, {
const listOfAdminEmails = [
"sample1@email.com",
"sample2@email.com",
"sample3@email.com"
]

const wrapper = shallowMount(Component, {
"global": {
"provide": {
"pageContext": {
"pageProps": {
listOfAdminEmails
}
}
}
},
"props": {
"receivedErrorFromPageContext": {
"detail": "redirected from authentication-guarded route"
Expand Down Expand Up @@ -82,7 +113,23 @@ describe("Component: Log In Form", () => {
}),
{ "status": RequestEnvironment.status.BAD_REQUEST })

const wrapper = shallowMount(Component)
const listOfAdminEmails = [
"sample1@email.com",
"sample2@email.com",
"sample3@email.com"
]

const wrapper = shallowMount(Component, {
"global": {
"provide": {
"pageContext": {
"pageProps": {
listOfAdminEmails
}
}
}
}
})
const emailField = wrapper.findComponent({ "name": "TextualField" })
const passwordField = wrapper.findComponent({ "name": "PasswordField" })
const submitBtn = wrapper.find(".submit-btn")
Expand Down

0 comments on commit b30efd6

Please sign in to comment.