mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-20 09:20:16 +00:00
Move read offer to RP (#326)
This commit is contained in:
@@ -7,15 +7,6 @@ export const minAutoPilotThroughput = 4000;
|
||||
|
||||
export const autoPilotIncrementStep = 1000;
|
||||
|
||||
export function isValidV3AutoPilotOffer(offer: Offer): boolean {
|
||||
const maxThroughput =
|
||||
offer &&
|
||||
offer.content &&
|
||||
offer.content.offerAutopilotSettings &&
|
||||
offer.content.offerAutopilotSettings.maxThroughput;
|
||||
return isValidAutoPilotThroughput(maxThroughput);
|
||||
}
|
||||
|
||||
export function isValidAutoPilotThroughput(maxThroughput: number): boolean {
|
||||
if (!maxThroughput) {
|
||||
return false;
|
||||
|
||||
@@ -1,51 +0,0 @@
|
||||
import * as Constants from "../../src/Common/Constants";
|
||||
import * as DataModels from "../../src/Contracts/DataModels";
|
||||
import { OfferUtils } from "../../src/Utils/OfferUtils";
|
||||
|
||||
describe("OfferUtils tests", () => {
|
||||
const offerV1: DataModels.Offer = {
|
||||
_rid: "",
|
||||
_self: "",
|
||||
_ts: 0,
|
||||
_etag: "",
|
||||
id: "v1",
|
||||
offerVersion: Constants.OfferVersions.V1,
|
||||
offerType: "Standard",
|
||||
offerResourceId: "",
|
||||
content: null,
|
||||
resource: ""
|
||||
};
|
||||
|
||||
const offerV2: DataModels.Offer = {
|
||||
_rid: "",
|
||||
_self: "",
|
||||
_ts: 0,
|
||||
_etag: "",
|
||||
id: "v1",
|
||||
offerVersion: Constants.OfferVersions.V2,
|
||||
offerType: "Standard",
|
||||
offerResourceId: "",
|
||||
content: null,
|
||||
resource: ""
|
||||
};
|
||||
|
||||
describe("isOfferV1()", () => {
|
||||
it("should return true for V1", () => {
|
||||
expect(OfferUtils.isOfferV1(offerV1)).toBeTruthy();
|
||||
});
|
||||
|
||||
it("should return false for V2", () => {
|
||||
expect(OfferUtils.isOfferV1(offerV2)).toBeFalsy();
|
||||
});
|
||||
});
|
||||
|
||||
describe("isNotOfferV1()", () => {
|
||||
it("should return true for V2", () => {
|
||||
expect(OfferUtils.isNotOfferV1(offerV2)).toBeTruthy();
|
||||
});
|
||||
|
||||
it("should return false for V1", () => {
|
||||
expect(OfferUtils.isNotOfferV1(offerV1)).toBeFalsy();
|
||||
});
|
||||
});
|
||||
});
|
||||
@@ -1,12 +0,0 @@
|
||||
import * as Constants from "../Common/Constants";
|
||||
import * as DataModels from "../Contracts/DataModels";
|
||||
|
||||
export class OfferUtils {
|
||||
public static isOfferV1(offer: DataModels.Offer): boolean {
|
||||
return !offer || offer.offerVersion !== Constants.OfferVersions.V2;
|
||||
}
|
||||
|
||||
public static isNotOfferV1(offer: DataModels.Offer): boolean {
|
||||
return !OfferUtils.isOfferV1(offer);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user