Commit d6826d38 authored by Mohammad Yousuf Khan's avatar Mohammad Yousuf Khan

Adds sample tests

parent f975962f
......@@ -15,7 +15,8 @@
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"build-bundle": "vue-cli-service build --target lib --name mComponents ./src/components/index.js",
"lint": "vue-cli-service lint"
"lint": "vue-cli-service lint",
"test:unit": "jest --coverage"
},
"dependencies": {
"axios": "^0.21.1",
......@@ -29,9 +30,22 @@
"@vue/cli-plugin-eslint": "~4.5.0",
"@vue/cli-service": "~4.5.0",
"@vue/compiler-sfc": "^3.0.0",
"@vue/test-utils": "^2.0.0-rc.11",
"babel-eslint": "^10.1.0",
"eslint": "^6.7.2",
"eslint-plugin-vue": "^7.0.0"
"eslint-plugin-vue": "^7.0.0",
"vue-jest": "^5.0.0-alpha.10"
},
"jest": {
"moduleFileExtensions": [
"js",
"json",
"vue"
],
"transform": {
"^.+\\.js$": "babel-jest",
"^.+\\.vue$": "vue-jest"
}
},
"eslintConfig": {
"root": true,
......
import { mount } from "@vue/test-utils";
// The component to test
const MessageComponent = {
template: "<p>{{ msg }}</p>",
props: ["msg"],
};
test("displays message", () => {
const wrapper = mount(MessageComponent, {
props: {
msg: "Hello world",
},
});
// Assert the rendered text of the component
expect(wrapper.text()).toContain("Hello world");
});
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment