Skip to content

Commit

Permalink
test(component): ensure MemoryButton
Browse files Browse the repository at this point in the history
  • Loading branch information
lemredd committed Dec 20, 2022
1 parent 9deae04 commit 624ff90
Showing 1 changed file with 20 additions and 0 deletions.
20 changes: 20 additions & 0 deletions src/components/CalculatorContainer/MemoryButton.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
import { shallowMount } from "@vue/test-utils"

import Component from "./MemoryButton.vue"

describe("Component: CalculatorContainer/MemoryButton", () => {
it("can emit custom value", async() => {
const wrapper = shallowMount(Component, {
"props": {
"value": "MC"
}
})
const memoryBtn = wrapper.find("button.memory-button")
const memoryBtnValue = wrapper.props("value")
expect(memoryBtn.text()).toEqual(String(memoryBtnValue))

await memoryBtn.trigger("click")
const expectedEmission = wrapper.emitted("appendToScreen")
expect(expectedEmission).toHaveProperty("0.0", memoryBtnValue)
})
})

0 comments on commit 624ff90

Please sign in to comment.