mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-04-06 09:59:20 +01:00
54 lines
2.2 KiB
TypeScript
54 lines
2.2 KiB
TypeScript
import { shallow } from "enzyme";
|
|
import React from "react";
|
|
import * as DataModels from "../../../../Contracts/DataModels";
|
|
import { collection } from "../TestUtils";
|
|
import { ConflictResolutionComponent, ConflictResolutionComponentProps } from "./ConflictResolutionComponent";
|
|
|
|
describe("ConflictResolutionComponent", () => {
|
|
const baseProps: ConflictResolutionComponentProps = {
|
|
collection: collection,
|
|
conflictResolutionPolicyMode: DataModels.ConflictResolutionMode.Custom,
|
|
conflictResolutionPolicyModeBaseline: DataModels.ConflictResolutionMode.Custom,
|
|
onConflictResolutionPolicyModeChange: () => {
|
|
return;
|
|
},
|
|
conflictResolutionPolicyPath: "",
|
|
conflictResolutionPolicyPathBaseline: "",
|
|
onConflictResolutionPolicyPathChange: () => {
|
|
return;
|
|
},
|
|
conflictResolutionPolicyProcedure: "",
|
|
conflictResolutionPolicyProcedureBaseline: "",
|
|
onConflictResolutionPolicyProcedureChange: () => {
|
|
return;
|
|
},
|
|
onConflictResolutionDirtyChange: () => {
|
|
return;
|
|
},
|
|
};
|
|
|
|
it("Sproc text field displayed", () => {
|
|
const wrapper = shallow(<ConflictResolutionComponent {...baseProps} />);
|
|
expect(wrapper).toMatchSnapshot();
|
|
expect(wrapper.exists("#conflictResolutionCustomTextField")).toEqual(true);
|
|
expect(wrapper.exists("#conflictResolutionLwwTextField")).toEqual(false);
|
|
});
|
|
|
|
it("Path text field displayed", () => {
|
|
const props = { ...baseProps, conflictResolutionPolicyMode: DataModels.ConflictResolutionMode.LastWriterWins };
|
|
const wrapper = shallow(<ConflictResolutionComponent {...props} />);
|
|
expect(wrapper).toMatchSnapshot();
|
|
expect(wrapper.exists("#conflictResolutionCustomTextField")).toEqual(false);
|
|
expect(wrapper.exists("#conflictResolutionLwwTextField")).toEqual(true);
|
|
});
|
|
|
|
it("conflict resolution policy dirty is set", () => {
|
|
let conflictRsolutionComponent = new ConflictResolutionComponent(baseProps);
|
|
expect(conflictRsolutionComponent.IsComponentDirty()).toEqual(false);
|
|
|
|
const newProps = { ...baseProps, conflictResolutionPolicyMode: DataModels.ConflictResolutionMode.LastWriterWins };
|
|
conflictRsolutionComponent = new ConflictResolutionComponent(newProps);
|
|
expect(conflictRsolutionComponent.IsComponentDirty()).toEqual(true);
|
|
});
|
|
});
|