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