diff --git a/src/components/CalculatorContainer/OperationalButton.test.ts b/src/components/CalculatorContainer/OperationalButton.test.ts new file mode 100644 index 0000000..14889f1 --- /dev/null +++ b/src/components/CalculatorContainer/OperationalButton.test.ts @@ -0,0 +1,20 @@ +import { shallowMount } from "@vue/test-utils" + +import Component from "./OperationalButton.vue" + +describe("Component: CalculatorContainer/OperationalButton", () => { + it("can emit custom value", async() => { + const wrapper = shallowMount(Component, { + "props": { + "value": 1 + } + }) + const operationalBtn = wrapper.find("button.operational-button") + const operationalBtnValue = wrapper.props("value") + expect(operationalBtn.text()).toEqual(String(operationalBtnValue)) + + await operationalBtn.trigger("click") + const expectedEmission = wrapper.emitted("appendToScreen") + expect(expectedEmission).toHaveProperty("0.0", operationalBtnValue) + }) +})