test-vue-composition-utils
v0.1.0
Published
Test utilities for Vue composition api.
Downloads
3
Maintainers
Readme
test-vue-composition-utils
Example
useCounter.js
import { reactive } from "vue";
function useCounter() {
const state = reactive({
count: 0,
});
const increment = () => {
state.count++;
};
return {
state,
increment,
};
}
export default useCounter;
useCounter.spec.js
import { renderCustomComposition } from "test-vue-composition-utils";
import useCounter from "./useCounter";
test("should increment counter", () => {
const { result } = renderCustomComposition(() => useCounter());
const { state, increment } = result.current;
expect(state.count).toBe(0);
increment();
expect(state.count).toBe(1);
});
Installation
npm install --save-dev test-vue-composition-utils
or
yarn add -D test-vue-composition-utils
API
See the API reference