mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-23 02:41:39 +00:00
* Add condition for showing quick start carousel * Show coach mark when carousel is closed * Add condition for showing quick start carousel and other UI changes * Fix compile error * Fix issue with coach mark * Fix test * Add new sample data, fix link url, fix e2e tests * Fix e2e tests
37 lines
1.2 KiB
TypeScript
37 lines
1.2 KiB
TypeScript
import { DataSamplesUtil } from "../DataSamples/DataSamplesUtil";
|
|
import Explorer from "../Explorer";
|
|
import { SplashScreen } from "./SplashScreen";
|
|
jest.mock("../Explorer");
|
|
|
|
const createExplorer = () => {
|
|
const mock = new Explorer();
|
|
return mock as jest.Mocked<Explorer>;
|
|
};
|
|
|
|
describe("SplashScreen", () => {
|
|
it("does not allow sample collection creation for non-supported api's", () => {
|
|
const explorerStub = createExplorer();
|
|
const dataSampleUtil = new DataSamplesUtil(explorerStub);
|
|
const createStub = jest
|
|
.spyOn(dataSampleUtil, "createGeneratorAsync")
|
|
.mockImplementation(() => Promise.reject(undefined));
|
|
|
|
// Sample is not supported
|
|
jest.spyOn(dataSampleUtil, "isSampleContainerCreationSupported").mockImplementation(() => false);
|
|
|
|
const splashScreen = new SplashScreen({ explorer: explorerStub });
|
|
jest.spyOn(splashScreen, "createDataSampleUtil").mockImplementation(() => dataSampleUtil);
|
|
const mainButtons = splashScreen.createMainItems();
|
|
|
|
// Press all buttons and make sure create doesn't get called
|
|
mainButtons.forEach((button) => {
|
|
try {
|
|
button.onClick();
|
|
} catch (e) {
|
|
// noop
|
|
}
|
|
});
|
|
expect(createStub).not.toHaveBeenCalled();
|
|
});
|
|
});
|