mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-20 17:30:46 +00:00
Remove Explorer.databaseAccount (#717)
Co-authored-by: Steve Faulkner <southpolesteve@gmail.com>
This commit is contained in:
@@ -1,4 +1,3 @@
|
||||
import ko from "knockout";
|
||||
import { HttpHeaders, HttpStatusCodes } from "../Common/Constants";
|
||||
import { DatabaseAccount } from "../Contracts/DataModels";
|
||||
import { updateUserContext, userContext } from "../UserContext";
|
||||
@@ -35,7 +34,7 @@ const samplePinnedRepos: IPinnedRepo[] = [
|
||||
];
|
||||
|
||||
describe("Pinned repos", () => {
|
||||
const junoClient = new JunoClient(ko.observable<DatabaseAccount>(sampleDatabaseAccount));
|
||||
const junoClient = new JunoClient();
|
||||
|
||||
beforeEach(() => {
|
||||
window.fetch = jest.fn().mockImplementation(() => {
|
||||
@@ -72,7 +71,7 @@ describe("Pinned repos", () => {
|
||||
});
|
||||
|
||||
describe("GitHub", () => {
|
||||
const junoClient = new JunoClient(ko.observable<DatabaseAccount>(sampleDatabaseAccount));
|
||||
const junoClient = new JunoClient();
|
||||
|
||||
afterEach(() => {
|
||||
jest.resetAllMocks();
|
||||
@@ -131,11 +130,16 @@ describe("GitHub", () => {
|
||||
});
|
||||
|
||||
describe("Gallery", () => {
|
||||
const junoClient = new JunoClient(ko.observable<DatabaseAccount>(sampleDatabaseAccount));
|
||||
const junoClient = new JunoClient();
|
||||
const originalSubscriptionId = userContext.subscriptionId;
|
||||
|
||||
beforeAll(() => {
|
||||
updateUserContext({ subscriptionId: sampleSubscriptionId });
|
||||
updateUserContext({
|
||||
databaseAccount: {
|
||||
name: "name",
|
||||
} as DatabaseAccount,
|
||||
subscriptionId: sampleSubscriptionId,
|
||||
});
|
||||
});
|
||||
|
||||
afterEach(() => {
|
||||
@@ -202,7 +206,6 @@ describe("Gallery", () => {
|
||||
status: HttpStatusCodes.OK,
|
||||
json: () => undefined as any,
|
||||
});
|
||||
|
||||
const response = await junoClient.increaseNotebookViews(id);
|
||||
|
||||
expect(response.status).toBe(HttpStatusCodes.OK);
|
||||
|
||||
@@ -70,7 +70,7 @@ export interface IPublishNotebookRequest {
|
||||
export class JunoClient {
|
||||
private cachedPinnedRepos: ko.Observable<IPinnedRepo[]>;
|
||||
|
||||
constructor(private databaseAccount?: ko.Observable<DataModels.DatabaseAccount>) {
|
||||
constructor() {
|
||||
this.cachedPinnedRepos = ko.observable<IPinnedRepo[]>([]);
|
||||
}
|
||||
|
||||
@@ -500,7 +500,7 @@ export class JunoClient {
|
||||
}
|
||||
|
||||
private getAccount(): string {
|
||||
return this.databaseAccount().name;
|
||||
return userContext?.databaseAccount?.name;
|
||||
}
|
||||
|
||||
private getSubscriptionId(): string {
|
||||
|
||||
Reference in New Issue
Block a user