mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-26 20:31:33 +00:00
Initial Move from Azure DevOps to GitHub
This commit is contained in:
@@ -0,0 +1,67 @@
|
||||
import React from "react";
|
||||
import { shallow } from "enzyme";
|
||||
import { GraphHighlightedNodeData } from "./GraphExplorer";
|
||||
|
||||
import {
|
||||
ReadOnlyNodePropertiesComponent,
|
||||
ReadOnlyNodePropertiesComponentProps
|
||||
} from "./ReadOnlyNodePropertiesComponent";
|
||||
|
||||
describe("<ReadOnlyNodePropertiesComponent />", () => {
|
||||
const id = "myId";
|
||||
const label = "myLabel";
|
||||
const mockNode: GraphHighlightedNodeData = {
|
||||
id: id,
|
||||
label: label,
|
||||
properties: {
|
||||
key1: ["value1"],
|
||||
key2: ["value2"]
|
||||
},
|
||||
areNeighborsUnknown: false,
|
||||
sources: [],
|
||||
targets: []
|
||||
};
|
||||
|
||||
it("renders id", () => {
|
||||
const props: ReadOnlyNodePropertiesComponentProps = { node: mockNode };
|
||||
const wrapper = shallow(<ReadOnlyNodePropertiesComponent {...props} />);
|
||||
expect(wrapper.find(".vertexId").text()).toBe(id);
|
||||
});
|
||||
|
||||
it("renders label", () => {
|
||||
const props: ReadOnlyNodePropertiesComponentProps = { node: mockNode };
|
||||
const wrapper = shallow(<ReadOnlyNodePropertiesComponent {...props} />);
|
||||
expect(wrapper.find(".vertexLabel").text()).toBe(label);
|
||||
});
|
||||
|
||||
it("renders properties (single value)", () => {
|
||||
const props: ReadOnlyNodePropertiesComponentProps = { node: mockNode };
|
||||
const wrapper = shallow(<ReadOnlyNodePropertiesComponent {...props} />);
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("renders properties (with multiple values)", () => {
|
||||
const mockNode2 = {
|
||||
...mockNode,
|
||||
properties: {
|
||||
key3: ["abcd", 1234, true, false, undefined, null]
|
||||
}
|
||||
};
|
||||
const props: ReadOnlyNodePropertiesComponentProps = { node: mockNode2 };
|
||||
const wrapper = shallow(<ReadOnlyNodePropertiesComponent {...props} />);
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
|
||||
it("renders unicode", () => {
|
||||
const mockNode2 = {
|
||||
...mockNode,
|
||||
properties: {
|
||||
key4: ["あきら, アキラ,安喜良"],
|
||||
key5: ["Véronique"]
|
||||
}
|
||||
};
|
||||
const props: ReadOnlyNodePropertiesComponentProps = { node: mockNode2 };
|
||||
const wrapper = shallow(<ReadOnlyNodePropertiesComponent {...props} />);
|
||||
expect(wrapper).toMatchSnapshot();
|
||||
});
|
||||
});
|
||||
Reference in New Issue
Block a user