mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-19 17:01:13 +00:00
DDM Updated the validation logic as per BE values (policyFormatVersion field is removed from BE) (#2237)
* updated the validation logic as per BE values(policyFormatVersion will be removed from BE) * removed field * updated all test --------- Co-authored-by: Sakshi Gupta <sakshig@microsoft.com>
This commit is contained in:
@@ -30,7 +30,6 @@ jest.mock("../../../Common/dataAccess/updateCollection", () => ({
|
||||
dataMaskingPolicy: {
|
||||
includedPaths: [],
|
||||
excludedPaths: ["/excludedPath"],
|
||||
policyFormatVersion: 2,
|
||||
isPolicyEnabled: true,
|
||||
},
|
||||
indexes: [],
|
||||
@@ -308,13 +307,11 @@ describe("SettingsComponent", () => {
|
||||
dataMaskingContent: {
|
||||
includedPaths: [],
|
||||
excludedPaths: ["/excludedPath"],
|
||||
policyFormatVersion: 2,
|
||||
isPolicyEnabled: true,
|
||||
},
|
||||
dataMaskingContentBaseline: {
|
||||
includedPaths: [],
|
||||
excludedPaths: [],
|
||||
policyFormatVersion: 2,
|
||||
isPolicyEnabled: false,
|
||||
},
|
||||
isDataMaskingDirty: true,
|
||||
@@ -329,7 +326,6 @@ describe("SettingsComponent", () => {
|
||||
expect(wrapper.state("dataMaskingContentBaseline")).toEqual({
|
||||
includedPaths: [],
|
||||
excludedPaths: ["/excludedPath"],
|
||||
policyFormatVersion: 2,
|
||||
isPolicyEnabled: true,
|
||||
});
|
||||
});
|
||||
@@ -344,7 +340,6 @@ describe("SettingsComponent", () => {
|
||||
const invalidPolicy: InvalidPolicy = {
|
||||
includedPaths: "invalid",
|
||||
excludedPaths: [],
|
||||
policyFormatVersion: 2,
|
||||
isPolicyEnabled: false,
|
||||
};
|
||||
// Use type assertion since we're deliberately testing with invalid data
|
||||
@@ -354,7 +349,6 @@ describe("SettingsComponent", () => {
|
||||
expect(wrapper.state("dataMaskingContent")).toEqual({
|
||||
includedPaths: "invalid",
|
||||
excludedPaths: [],
|
||||
policyFormatVersion: 2,
|
||||
isPolicyEnabled: false,
|
||||
});
|
||||
expect(wrapper.state("dataMaskingValidationErrors")).toEqual(["includedPaths must be an array"]);
|
||||
@@ -370,7 +364,6 @@ describe("SettingsComponent", () => {
|
||||
},
|
||||
],
|
||||
excludedPaths: ["/excludedPath"],
|
||||
policyFormatVersion: 2,
|
||||
isPolicyEnabled: true,
|
||||
};
|
||||
|
||||
@@ -395,7 +388,6 @@ describe("SettingsComponent", () => {
|
||||
},
|
||||
],
|
||||
excludedPaths: ["/excludedPath1"],
|
||||
policyFormatVersion: 2,
|
||||
isPolicyEnabled: false,
|
||||
};
|
||||
|
||||
@@ -409,7 +401,6 @@ describe("SettingsComponent", () => {
|
||||
},
|
||||
],
|
||||
excludedPaths: ["/excludedPath2"],
|
||||
policyFormatVersion: 2,
|
||||
isPolicyEnabled: true,
|
||||
};
|
||||
|
||||
|
||||
@@ -700,9 +700,6 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
||||
if (!Array.isArray(newDataMasking.excludedPaths)) {
|
||||
validationErrors.push("excludedPaths must be an array");
|
||||
}
|
||||
if (typeof newDataMasking.policyFormatVersion !== "number") {
|
||||
validationErrors.push("policyFormatVersion must be a number");
|
||||
}
|
||||
if (typeof newDataMasking.isPolicyEnabled !== "boolean") {
|
||||
validationErrors.push("isPolicyEnabled must be a boolean");
|
||||
}
|
||||
@@ -845,7 +842,6 @@ export class SettingsComponent extends React.Component<SettingsComponentProps, S
|
||||
const dataMaskingContent: DataModels.DataMaskingPolicy = {
|
||||
includedPaths: this.collection.dataMaskingPolicy?.()?.includedPaths || [],
|
||||
excludedPaths: this.collection.dataMaskingPolicy?.()?.excludedPaths || [],
|
||||
policyFormatVersion: this.collection.dataMaskingPolicy?.()?.policyFormatVersion || 2,
|
||||
isPolicyEnabled: this.collection.dataMaskingPolicy?.()?.isPolicyEnabled || false,
|
||||
};
|
||||
const conflictResolutionPolicy: DataModels.ConflictResolutionPolicy =
|
||||
|
||||
@@ -53,7 +53,6 @@ describe("DataMaskingComponent", () => {
|
||||
},
|
||||
],
|
||||
excludedPaths: [],
|
||||
policyFormatVersion: 2,
|
||||
isPolicyEnabled: false,
|
||||
};
|
||||
|
||||
@@ -175,7 +174,6 @@ describe("DataMaskingComponent", () => {
|
||||
const invalidPolicy: Record<string, unknown> = {
|
||||
includedPaths: "not an array",
|
||||
excludedPaths: [] as string[],
|
||||
policyFormatVersion: "not a number",
|
||||
isPolicyEnabled: "not a boolean",
|
||||
};
|
||||
|
||||
|
||||
@@ -33,7 +33,6 @@ const emptyDataMaskingPolicy: DataModels.DataMaskingPolicy = {
|
||||
},
|
||||
],
|
||||
excludedPaths: [],
|
||||
policyFormatVersion: 2,
|
||||
isPolicyEnabled: false,
|
||||
};
|
||||
|
||||
|
||||
@@ -68,7 +68,6 @@ export const collection = {
|
||||
dataMaskingPolicy: ko.observable<DataModels.DataMaskingPolicy>({
|
||||
includedPaths: [],
|
||||
excludedPaths: ["/excludedPath"],
|
||||
policyFormatVersion: 2,
|
||||
isPolicyEnabled: true,
|
||||
}),
|
||||
readSettings: () => {
|
||||
|
||||
Reference in New Issue
Block a user