mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-25 03:41:19 +00:00
36 lines
1.0 KiB
TypeScript
36 lines
1.0 KiB
TypeScript
jest.mock("../CosmosClient");
|
|
import { AuthType } from "../../AuthType";
|
|
import { DatabaseAccount } from "../../Contracts/DataModels";
|
|
import { DefaultAccountExperienceType } from "../../DefaultAccountExperienceType";
|
|
import { client } from "../CosmosClient";
|
|
import { readCollection } from "./readCollection";
|
|
import { updateUserContext } from "../../UserContext";
|
|
|
|
describe("readCollection", () => {
|
|
beforeAll(() => {
|
|
updateUserContext({
|
|
databaseAccount: {
|
|
name: "test"
|
|
} as DatabaseAccount,
|
|
defaultExperience: DefaultAccountExperienceType.DocumentDB
|
|
});
|
|
});
|
|
|
|
it("should call SDK if logged in with resource token", async () => {
|
|
window.authType = AuthType.ResourceToken;
|
|
(client as jest.Mock).mockReturnValue({
|
|
database: () => {
|
|
return {
|
|
container: () => {
|
|
return {
|
|
read: (): unknown => ({})
|
|
};
|
|
}
|
|
};
|
|
}
|
|
});
|
|
await readCollection("database", "collection");
|
|
expect(client).toHaveBeenCalled();
|
|
});
|
|
});
|