mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-07-12 15:05:13 +01:00
fix self serve tests
This commit is contained in:
parent
14db9e819a
commit
aee8249ffa
@ -7,45 +7,48 @@ import {
|
|||||||
} from "./SelfServeUtils";
|
} from "./SelfServeUtils";
|
||||||
|
|
||||||
describe("SelfServeUtils", () => {
|
describe("SelfServeUtils", () => {
|
||||||
|
const getSelfServeTypeExample = (): SelfServeType => {
|
||||||
|
return SelfServeType.example;
|
||||||
|
};
|
||||||
|
|
||||||
it("initialize should be declared for self serve classes", () => {
|
it("initialize should be declared for self serve classes", () => {
|
||||||
class Test extends SelfServeBaseClass {
|
class SelfServeExample extends SelfServeBaseClass {
|
||||||
public initialize: () => Promise<Map<string, SmartUiInput>>;
|
public initialize: () => Promise<Map<string, SmartUiInput>>;
|
||||||
public onSave: (currentValues: Map<string, SmartUiInput>) => Promise<OnSaveResult>;
|
public onSave: (currentValues: Map<string, SmartUiInput>) => Promise<OnSaveResult>;
|
||||||
public onRefresh: () => Promise<RefreshResult>;
|
public onRefresh: () => Promise<RefreshResult>;
|
||||||
public getSelfServeType: () => SelfServeType;
|
public getSelfServeType = (): SelfServeType => getSelfServeTypeExample();
|
||||||
}
|
}
|
||||||
expect(() => new Test().toSelfServeDescriptor()).toThrow("initialize() was not declared for the class 'Test'");
|
expect(() => new SelfServeExample().toSelfServeDescriptor()).toThrow("initialize() was not declared for the class 'SelfServeExample'");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("onSave should be declared for self serve classes", () => {
|
it("onSave should be declared for self serve classes", () => {
|
||||||
class Test extends SelfServeBaseClass {
|
class SelfServeExample extends SelfServeBaseClass {
|
||||||
public initialize = jest.fn();
|
public initialize = jest.fn();
|
||||||
public onSave: () => Promise<OnSaveResult>;
|
public onSave: () => Promise<OnSaveResult>;
|
||||||
public onRefresh: () => Promise<RefreshResult>;
|
public onRefresh: () => Promise<RefreshResult>;
|
||||||
public getSelfServeType: () => SelfServeType;
|
public getSelfServeType = (): SelfServeType => getSelfServeTypeExample();
|
||||||
}
|
}
|
||||||
expect(() => new Test().toSelfServeDescriptor()).toThrow("onSave() was not declared for the class 'Test'");
|
expect(() => new SelfServeExample().toSelfServeDescriptor()).toThrow("onSave() was not declared for the class 'SelfServeExample'");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("onRefresh should be declared for self serve classes", () => {
|
it("onRefresh should be declared for self serve classes", () => {
|
||||||
class Test extends SelfServeBaseClass {
|
class SelfServeExample extends SelfServeBaseClass {
|
||||||
public initialize = jest.fn();
|
public initialize = jest.fn();
|
||||||
public onSave = jest.fn();
|
public onSave = jest.fn();
|
||||||
public onRefresh: () => Promise<RefreshResult>;
|
public onRefresh: () => Promise<RefreshResult>;
|
||||||
public getSelfServeType: () => SelfServeType;
|
public getSelfServeType = (): SelfServeType => getSelfServeTypeExample();
|
||||||
}
|
}
|
||||||
expect(() => new Test().toSelfServeDescriptor()).toThrow("onRefresh() was not declared for the class 'Test'");
|
expect(() => new SelfServeExample().toSelfServeDescriptor()).toThrow("onRefresh() was not declared for the class 'SelfServeExample'");
|
||||||
});
|
});
|
||||||
|
|
||||||
it("@IsDisplayable decorator must be present for self serve classes", () => {
|
it("@IsDisplayable decorator must be present for self serve classes", () => {
|
||||||
class Test extends SelfServeBaseClass {
|
class SelfServeExample extends SelfServeBaseClass {
|
||||||
public initialize = jest.fn();
|
public initialize = jest.fn();
|
||||||
public onSave = jest.fn();
|
public onSave = jest.fn();
|
||||||
public onRefresh = jest.fn();
|
public onRefresh = jest.fn();
|
||||||
public getSelfServeType = jest.fn();
|
public getSelfServeType = (): SelfServeType => getSelfServeTypeExample();
|
||||||
}
|
}
|
||||||
expect(() => new Test().toSelfServeDescriptor()).toThrow(
|
expect(() => new SelfServeExample().toSelfServeDescriptor()).toThrow(
|
||||||
"@IsDisplayable decorator was not declared for the class 'Test'",
|
"@IsDisplayable decorator was not declared for the class 'SelfServeExample'",
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user