Skip to content

Commit

Permalink
feat: add basic test setup (carbon-design-system#943)
Browse files Browse the repository at this point in the history
Co-authored-by: Lee Chase <lee.chase@uk.ibm.com>
  • Loading branch information
lee-chase and lee-chase committed Mar 1, 2021
1 parent 01e8e5e commit 8881ba7
Show file tree
Hide file tree
Showing 3 changed files with 48 additions and 8 deletions.
18 changes: 18 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
version: 2
jobs:
test:
docker:
- image: circleci/node:14
working_directory: ~/repo
steps:
- checkout
- run: yarn install --immutable --immutable-cache
- run:
name: Run ci checks
command: yarn ci-check

workflows:
version: 2
main:
jobs:
- test
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"scripts": {
"serve": "vue-cli-service serve",
"build": "vue-cli-service build",
"ci-check": "yarn format:diff",
"ci-check": "yarn format:diff && yarn test:unit",
"format:diff": "prettier --list-different \"src/**/*.{js,vue,scss}\"",
"lint": "vue-cli-service lint",
"test:unit": "vue-cli-service test:unit"
Expand Down
36 changes: 29 additions & 7 deletions tests/unit/example.spec.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,34 @@
import { shallowMount } from '@vue/test-utils';
import HelloWorld from '@/components/HelloWorld.vue';
import App from '@/App.vue';

describe('HelloWorld.vue', () => {
it('renders props.msg when passed', () => {
const msg = 'new message';
const wrapper = shallowMount(HelloWorld, {
propsData: { msg }
describe('App', () => {
const dummyContent = 'dummy content';

it('should load app with dummy content', () => {
const wrapper = shallowMount(App, {
slots: { default: dummyContent }
});
expect(wrapper.text()).toMatch(msg);
const app = wrapper.find('#app');
expect(app).not.toBeNull;
});
});

// describe('HelloWorld.vue', () => {
// it('renders props.msg when passed', () => {
// const msg = 'new message';
// const wrapper = shallowMount(HelloWorld, {
// propsData: { msg }
// });
// expect(wrapper.text()).toMatch(msg);
// });
// });

// import React from 'react';
// import ReactDOM from 'react-dom';
// import App from './App';

// it('renders without crashing', () => {
// const div = document.createElement('div');
// ReactDOM.render(<App />, div);
// ReactDOM.unmountComponentAtNode(div);
// });

0 comments on commit 8881ba7

Please sign in to comment.