Skip to content

Commit

Permalink
test(intg): ensure functionality of sqrBtn
Browse files Browse the repository at this point in the history
  • Loading branch information
lemredd committed Dec 23, 2022
1 parent 755a64a commit 57c3f00
Showing 1 changed file with 21 additions and 0 deletions.
21 changes: 21 additions & 0 deletions src/components/CalculatorContainer.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -97,5 +97,26 @@ describe("Component: CalculatorContainer", () => {
expect(entryScrn.value).toEqual("0.5")
})

it("can square given entry", async() => {
const wrapper = mount(Component)
const evaluationScrn = wrapper.find(".evaluation-screen")
const entryScrn = wrapper.find(".entry-screen").element as HTMLInputElement

// Find the digits "1" and "2" buttons and click digit "1" button
const digitalBtns = wrapper.findAll(".digital-button")
const [digital8Btn] = digitalBtns.filter(btn => btn.text() === "8")
await digital8Btn.trigger("click")
expect(entryScrn.value).toEqual("8")
expect(evaluationScrn.text()).toEqual("")

// Find the Fraction button and click it
const evaluationBtns = wrapper.findAll(".evaluation-button")
const [sqrBtn] = evaluationBtns.filter(btn => btn.text() === "x²")
await sqrBtn.trigger("click")
expect(evaluationScrn.text()).toEqual("sqr(8)")
expect(entryScrn.value).toEqual("64")

})

it.todo("can continuously evaluate")
})

0 comments on commit 57c3f00

Please sign in to comment.