mirror of
https://github.com/Azure/cosmos-explorer.git
synced 2025-12-20 01:11:25 +00:00
Prettier 2.0 (#393)
This commit is contained in:
@@ -12,7 +12,7 @@ interface Global {
|
||||
describe("ARM request", () => {
|
||||
window.authType = AuthType.AAD;
|
||||
updateUserContext({
|
||||
authorizationToken: "some-token"
|
||||
authorizationToken: "some-token",
|
||||
});
|
||||
|
||||
it("should call window.fetch", async () => {
|
||||
@@ -20,7 +20,7 @@ describe("ARM request", () => {
|
||||
ok: true,
|
||||
json: async () => {
|
||||
return {};
|
||||
}
|
||||
},
|
||||
});
|
||||
await armRequest({ apiVersion: "2001-01-01", host: "https://foo.com", path: "foo", method: "GET" });
|
||||
expect(window.fetch).toHaveBeenCalled();
|
||||
@@ -33,7 +33,7 @@ describe("ARM request", () => {
|
||||
ok: true,
|
||||
headers,
|
||||
status: 200,
|
||||
json: async () => ({})
|
||||
json: async () => ({}),
|
||||
});
|
||||
await armRequest({ apiVersion: "2001-01-01", host: "https://foo.com", path: "foo", method: "GET" });
|
||||
expect(window.fetch).toHaveBeenCalledTimes(2);
|
||||
@@ -48,7 +48,7 @@ describe("ARM request", () => {
|
||||
status: 200,
|
||||
json: async () => {
|
||||
return { status: "Failed" };
|
||||
}
|
||||
},
|
||||
});
|
||||
await expect(() =>
|
||||
armRequest({ apiVersion: "2001-01-01", host: "https://foo.com", path: "foo", method: "GET" })
|
||||
@@ -59,7 +59,7 @@ describe("ARM request", () => {
|
||||
it("should throw token error", async () => {
|
||||
window.authType = AuthType.AAD;
|
||||
updateUserContext({
|
||||
authorizationToken: undefined
|
||||
authorizationToken: undefined,
|
||||
});
|
||||
const headers = new Headers();
|
||||
headers.set("location", "https://foo.com/operationStatus");
|
||||
@@ -69,7 +69,7 @@ describe("ARM request", () => {
|
||||
status: 200,
|
||||
json: async () => {
|
||||
return { status: "Failed" };
|
||||
}
|
||||
},
|
||||
});
|
||||
await expect(() =>
|
||||
armRequest({ apiVersion: "2001-01-01", host: "https://foo.com", path: "foo", method: "GET" })
|
||||
|
||||
@@ -54,7 +54,7 @@ export async function armRequest<T>({
|
||||
apiVersion,
|
||||
method,
|
||||
body: requestBody,
|
||||
queryParams
|
||||
queryParams,
|
||||
}: Options): Promise<T> {
|
||||
const url = new URL(path, host);
|
||||
url.searchParams.append("api-version", configContext.armAPIVersion || apiVersion);
|
||||
@@ -70,9 +70,9 @@ export async function armRequest<T>({
|
||||
const response = await window.fetch(url.href, {
|
||||
method,
|
||||
headers: {
|
||||
Authorization: userContext.authorizationToken
|
||||
Authorization: userContext.authorizationToken,
|
||||
},
|
||||
body: requestBody ? JSON.stringify(requestBody) : undefined
|
||||
body: requestBody ? JSON.stringify(requestBody) : undefined,
|
||||
});
|
||||
if (!response.ok) {
|
||||
let error: ARMError;
|
||||
@@ -108,8 +108,8 @@ async function getOperationStatus(operationStatusUrl: string) {
|
||||
|
||||
const response = await window.fetch(operationStatusUrl, {
|
||||
headers: {
|
||||
Authorization: userContext.authorizationToken
|
||||
}
|
||||
Authorization: userContext.authorizationToken,
|
||||
},
|
||||
});
|
||||
|
||||
if (!response.ok) {
|
||||
|
||||
Reference in New Issue
Block a user