github.com/replicatedhq/ship@v0.55.0/web/init/src/components/kustomize/kustomize_overlay/AceEditorHOC.spec.js (about) 1 import React from "react"; 2 import { mount } from "enzyme"; 3 import { AceEditorHOC } from "./AceEditorHOC"; 4 5 const testYaml = ` 6 apiVersion: v1 7 kind: Service 8 metadata: 9 name: -mytest 10 labels: 11 app: mytest 12 chart: mytest-0.0.1 13 spec: 14 ports: 15 - name: myPort 16 port: 1111 17 selector: 18 app: mytest 19 release: 20 `; 21 22 describe("AceEditorHOC", () => { 23 describe("provided a valid yaml that is supported", () => { 24 const wrapper = mount(<AceEditorHOC fileToView={{ baseContent: "" }} />); 25 it("creates markers for all values", () => { 26 wrapper.setProps({ 27 fileToView: { baseContent: testYaml, isSupported: true }, 28 }); 29 const markers = wrapper.state().markers; 30 expect(markers).toHaveLength(9); 31 }); 32 }); 33 describe("provided an unsupported yaml", () => { 34 const wrapper = mount(<AceEditorHOC fileToView={{ baseContent: "" }} />); 35 it("creates markers for all values", () => { 36 wrapper.setProps({ 37 fileToView: { baseContent: testYaml, isSupported: false }, 38 }); 39 const markers = wrapper.state().markers; 40 expect(markers).toHaveLength(0); 41 }); 42 }); 43 });