Skip to content

Instantly share code, notes, and snippets.

@darrenjennings
Created November 22, 2017 20:29
Show Gist options
  • Save darrenjennings/5a0be5aa128dce08943ddcfdf082b1bd to your computer and use it in GitHub Desktop.
Save darrenjennings/5a0be5aa128dce08943ddcfdf082b1bd to your computer and use it in GitHub Desktop.
import { shallow } from "vue-test-utils";
import { createRenderer } from "vue-server-renderer";
import VueToAKill from "../src/VueToAKill.vue";
const defaultProps = {
agents: ['James Bond', 'Alec Trevelyan', 'M', 'Q'],
licenseToKill: true
};
it("can mount", () => {
const props = Object.assign({}, defaultProps);
props.licenseToKill = false;
const wrapper = shallow(VueToAKill, {
propsData: props
});
expect(wrapper.findAll(`ul li`).length).toBeLessThanOrEqual(
props.agents.length
);
const renderer = createRenderer();
renderer.renderToString(wrapper.vm, (err, str) => {
if (err) throw new Error(err);
expect(str).toMatchSnapshot();
});
});
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment