refactor: lint

This commit is contained in:
liyasthomas
2021-05-18 14:57:29 +05:30
parent 7f248da0b3
commit cc27c552af
84 changed files with 1444 additions and 973 deletions

View File

@@ -7,9 +7,9 @@ jest.mock("~/newstore/settings", () => {
__esModule: true,
settingsStore: {
value: {
PROXY_ENABLED: false
}
}
PROXY_ENABLED: false,
},
},
}
})
@@ -18,7 +18,6 @@ axios.mockResolvedValue({})
describe("axiosStrategy", () => {
describe("No-Proxy Requests", () => {
test("sends request to the actual sender if proxy disabled", async () => {
await axiosStrategy({ url: "test" })
@@ -43,14 +42,14 @@ describe("axiosStrategy", () => {
await expect(axiosStrategy({})).resolves.toBeDefined()
})
test("rejects cancel errors with text 'cancellation'", async () => {
test("rejects cancel errors with text 'cancellation'", () => {
axios.isCancel.mockReturnValueOnce(true)
axios.mockRejectedValue("err")
expect(axiosStrategy({})).rejects.toBe("cancellation")
})
test("rejects non-cancellation errors as-is", async () => {
test("rejects non-cancellation errors as-is", () => {
axios.isCancel.mockReturnValueOnce(false)
axios.mockRejectedValue("err")

View File

@@ -1,5 +1,8 @@
import axios from "axios"
import axiosStrategy, { testables, cancelRunningAxiosRequest } from "../AxiosStrategy"
import axiosStrategy, {
testables,
cancelRunningAxiosRequest,
} from "../AxiosStrategy"
jest.mock("../../utils/b64", () => ({
__esModule: true,
@@ -11,9 +14,9 @@ jest.mock("~/newstore/settings", () => {
settingsStore: {
value: {
PROXY_ENABLED: true,
PROXY_URL: "test"
}
}
PROXY_URL: "test",
},
},
}
})
@@ -28,7 +31,6 @@ describe("cancelRunningAxiosRequest", () => {
describe("axiosStrategy", () => {
describe("Proxy Requests", () => {
test("sends POST request to proxy if proxy is enabled", async () => {
let passedURL

View File

@@ -1,4 +1,3 @@
import extensionStrategy, {
hasExtensionInstalled,
hasChromeExtensionInstalled,
@@ -17,9 +16,9 @@ jest.mock("~/newstore/settings", () => {
settingsStore: {
value: {
EXTENSIONS_ENABLED: true,
PROXY_ENABLED: false
}
}
PROXY_ENABLED: false,
},
},
}
})
@@ -140,7 +139,6 @@ describe("extensionStrategy", () => {
})
describe("Non-Proxy Requests", () => {
test("ask extension to send request", async () => {
global.__POSTWOMAN_EXTENSION_HOOK__ = {
sendRequest: sendReqFunc,
@@ -162,7 +160,7 @@ describe("extensionStrategy", () => {
sendRequest: sendReqFunc,
}
sendReqFunc.mockImplementation(({ method, url }) => {
sendReqFunc.mockImplementation(({ url }) => {
passedUrl = url
return Promise.resolve({

View File

@@ -17,9 +17,9 @@ jest.mock("~/newstore/settings", () => {
value: {
EXTENSIONS_ENABLED: true,
PROXY_ENABLED: true,
PROXY_URL: "test"
}
}
PROXY_URL: "test",
},
},
}
})
@@ -140,7 +140,6 @@ describe("extensionStrategy", () => {
})
describe("Proxy Requests", () => {
test("asks extension to send request", async () => {
global.__POSTWOMAN_EXTENSION_HOOK__ = {
sendRequest: sendReqFunc,