chore: lint + bump deps

This commit is contained in:
liyasthomas
2021-11-04 18:23:50 +05:30
parent ad76d100ee
commit 9e74a8c2e7
32 changed files with 1248 additions and 1265 deletions

View File

@@ -4,7 +4,7 @@ import "@relmify/jest-fp-ts"
const fakeResponse: TestResponse = {
status: 200,
body: "hoi",
headers: []
headers: [],
}
describe("toBe", () => {
@@ -19,7 +19,9 @@ describe("toBe", () => {
)()
).resolves.toEqualRight([
expect.objectContaining({
expectResults: [{ status: "pass", message: "Expected '2' to be '2'" }],
expectResults: [
{ status: "pass", message: "Expected '2' to be '2'" },
],
}),
])
})
@@ -34,7 +36,9 @@ describe("toBe", () => {
)()
).resolves.toEqualRight([
expect.objectContaining({
expectResults: [{ status: "fail", message: "Expected '2' to be '4'" }],
expectResults: [
{ status: "fail", message: "Expected '2' to be '4'" },
],
}),
])
})
@@ -51,10 +55,12 @@ describe("toBe", () => {
)()
).resolves.toEqualRight([
expect.objectContaining({
expectResults: [{
status: "fail",
message: "Expected '2' to not be '2'",
}],
expectResults: [
{
status: "fail",
message: "Expected '2' to not be '2'",
},
],
}),
])
})
@@ -69,10 +75,12 @@ describe("toBe", () => {
)()
).resolves.toEqualRight([
expect.objectContaining({
expectResults: [{
status: "pass",
message: "Expected '2' to not be '4'",
}],
expectResults: [
{
status: "pass",
message: "Expected '2' to not be '4'",
},
],
}),
])
})
@@ -85,14 +93,16 @@ test("strict checks types", () => {
`
pw.expect(2).toBe("2")
`,
fakeResponse
fakeResponse
)()
).resolves.toEqualRight([
expect.objectContaining({
expectResults: [{
status: "fail",
message: "Expected '2' to be '2'",
}],
expectResults: [
{
status: "fail",
message: "Expected '2' to be '2'",
},
],
}),
])
})

View File

@@ -4,7 +4,7 @@ import "@relmify/jest-fp-ts"
const fakeResponse: TestResponse = {
status: 200,
body: "hoi",
headers: []
headers: [],
}
describe("toBeLevel2xx", () => {
@@ -14,10 +14,12 @@ describe("toBeLevel2xx", () => {
execTestScript(`pw.expect(${i}).toBeLevel2xx()`, fakeResponse)()
).resolves.toEqualRight([
expect.objectContaining({
expectResults: [{
status: "pass",
message: `Expected '${i}' to be 200-level status`,
}],
expectResults: [
{
status: "pass",
message: `Expected '${i}' to be 200-level status`,
},
],
}),
])
}
@@ -29,10 +31,12 @@ describe("toBeLevel2xx", () => {
execTestScript(`pw.expect(${i}).toBeLevel2xx()`, fakeResponse)()
).resolves.toEqualRight([
expect.objectContaining({
expectResults: [{
status: "fail",
message: `Expected '${i}' to be 200-level status`,
}],
expectResults: [
{
status: "fail",
message: `Expected '${i}' to be 200-level status`,
},
],
}),
])
}
@@ -43,11 +47,14 @@ describe("toBeLevel2xx", () => {
execTestScript(`pw.expect("foo").toBeLevel2xx()`, fakeResponse)()
).resolves.toEqualRight([
expect.objectContaining({
expectResults: [{
status: "error",
message: "Expected 200-level status but could not parse value 'foo'",
}],
})
expectResults: [
{
status: "error",
message:
"Expected 200-level status but could not parse value 'foo'",
},
],
}),
])
})
@@ -57,10 +64,12 @@ describe("toBeLevel2xx", () => {
execTestScript(`pw.expect(${i}).not.toBeLevel2xx()`, fakeResponse)()
).resolves.toEqualRight([
expect.objectContaining({
expectResults: [{
status: "fail",
message: `Expected '${i}' to not be 200-level status`,
}],
expectResults: [
{
status: "fail",
message: `Expected '${i}' to not be 200-level status`,
},
],
}),
])
}
@@ -72,10 +81,12 @@ describe("toBeLevel2xx", () => {
execTestScript(`pw.expect(${i}).not.toBeLevel2xx()`, fakeResponse)()
).resolves.toEqualRight([
expect.objectContaining({
expectResults: [{
status: "pass",
message: `Expected '${i}' to not be 200-level status`,
}],
expectResults: [
{
status: "pass",
message: `Expected '${i}' to not be 200-level status`,
},
],
}),
])
}
@@ -86,11 +97,14 @@ describe("toBeLevel2xx", () => {
execTestScript(`pw.expect("foo").not.toBeLevel2xx()`, fakeResponse)()
).resolves.toEqualRight([
expect.objectContaining({
expectResults: [{
status: "error",
message: "Expected 200-level status but could not parse value 'foo'",
}],
})
expectResults: [
{
status: "error",
message:
"Expected 200-level status but could not parse value 'foo'",
},
],
}),
])
})
})
@@ -102,10 +116,12 @@ describe("toBeLevel3xx", () => {
execTestScript(`pw.expect(${i}).toBeLevel3xx()`, fakeResponse)()
).resolves.toEqualRight([
expect.objectContaining({
expectResults: [{
status: "pass",
message: `Expected '${i}' to be 300-level status`,
}],
expectResults: [
{
status: "pass",
message: `Expected '${i}' to be 300-level status`,
},
],
}),
])
}
@@ -117,10 +133,12 @@ describe("toBeLevel3xx", () => {
execTestScript(`pw.expect(${i}).toBeLevel3xx()`, fakeResponse)()
).resolves.toEqualRight([
expect.objectContaining({
expectResults: [{
status: "fail",
message: `Expected '${i}' to be 300-level status`,
}],
expectResults: [
{
status: "fail",
message: `Expected '${i}' to be 300-level status`,
},
],
}),
])
}
@@ -131,11 +149,14 @@ describe("toBeLevel3xx", () => {
execTestScript(`pw.expect("foo").toBeLevel3xx()`, fakeResponse)()
).resolves.toEqualRight([
expect.objectContaining({
expectResults: [{
status: "error",
message: "Expected 300-level status but could not parse value 'foo'",
}],
})
expectResults: [
{
status: "error",
message:
"Expected 300-level status but could not parse value 'foo'",
},
],
}),
])
})
@@ -145,10 +166,12 @@ describe("toBeLevel3xx", () => {
execTestScript(`pw.expect(${i}).not.toBeLevel3xx()`, fakeResponse)()
).resolves.toEqualRight([
expect.objectContaining({
expectResults: [{
status: "fail",
message: `Expected '${i}' to not be 300-level status`,
}],
expectResults: [
{
status: "fail",
message: `Expected '${i}' to not be 300-level status`,
},
],
}),
])
}
@@ -160,10 +183,12 @@ describe("toBeLevel3xx", () => {
execTestScript(`pw.expect(${i}).not.toBeLevel3xx()`, fakeResponse)()
).resolves.toEqualRight([
expect.objectContaining({
expectResults: [{
status: "pass",
message: `Expected '${i}' to not be 300-level status`,
}],
expectResults: [
{
status: "pass",
message: `Expected '${i}' to not be 300-level status`,
},
],
}),
])
}
@@ -174,14 +199,16 @@ describe("toBeLevel3xx", () => {
execTestScript(`pw.expect("foo").not.toBeLevel3xx()`, fakeResponse)()
).resolves.toEqualRight([
expect.objectContaining({
expectResults: [{
status: "error",
message: "Expected 300-level status but could not parse value 'foo'",
}]
})
expectResults: [
{
status: "error",
message:
"Expected 300-level status but could not parse value 'foo'",
},
],
}),
])
})
})
describe("toBeLevel4xx", () => {
@@ -191,10 +218,12 @@ describe("toBeLevel4xx", () => {
execTestScript(`pw.expect(${i}).toBeLevel4xx()`, fakeResponse)()
).resolves.toEqualRight([
expect.objectContaining({
expectResults: [{
status: "pass",
message: `Expected '${i}' to be 400-level status`,
}],
expectResults: [
{
status: "pass",
message: `Expected '${i}' to be 400-level status`,
},
],
}),
])
}
@@ -206,10 +235,12 @@ describe("toBeLevel4xx", () => {
execTestScript(`pw.expect(${i}).toBeLevel4xx()`, fakeResponse)()
).resolves.toEqualRight([
expect.objectContaining({
expectResults: [{
status: "fail",
message: `Expected '${i}' to be 400-level status`,
}],
expectResults: [
{
status: "fail",
message: `Expected '${i}' to be 400-level status`,
},
],
}),
])
}
@@ -220,11 +251,14 @@ describe("toBeLevel4xx", () => {
execTestScript(`pw.expect("foo").toBeLevel4xx()`, fakeResponse)()
).resolves.toEqualRight([
expect.objectContaining({
expectResults: [{
status: "error",
message: "Expected 400-level status but could not parse value 'foo'",
}],
})
expectResults: [
{
status: "error",
message:
"Expected 400-level status but could not parse value 'foo'",
},
],
}),
])
})
@@ -234,10 +268,12 @@ describe("toBeLevel4xx", () => {
execTestScript(`pw.expect(${i}).not.toBeLevel4xx()`, fakeResponse)()
).resolves.toEqualRight([
expect.objectContaining({
expectResults: [{
status: "fail",
message: `Expected '${i}' to not be 400-level status`,
}],
expectResults: [
{
status: "fail",
message: `Expected '${i}' to not be 400-level status`,
},
],
}),
])
}
@@ -249,10 +285,12 @@ describe("toBeLevel4xx", () => {
execTestScript(`pw.expect(${i}).not.toBeLevel4xx()`, fakeResponse)()
).resolves.toEqualRight([
expect.objectContaining({
expectResults: [{
status: "pass",
message: `Expected '${i}' to not be 400-level status`,
}],
expectResults: [
{
status: "pass",
message: `Expected '${i}' to not be 400-level status`,
},
],
}),
])
}
@@ -263,11 +301,14 @@ describe("toBeLevel4xx", () => {
execTestScript(`pw.expect("foo").not.toBeLevel4xx()`, fakeResponse)()
).resolves.toEqualRight([
expect.objectContaining({
expectResults: [{
status: "error",
message: "Expected 400-level status but could not parse value 'foo'",
}],
})
expectResults: [
{
status: "error",
message:
"Expected 400-level status but could not parse value 'foo'",
},
],
}),
])
})
})
@@ -279,10 +320,12 @@ describe("toBeLevel5xx", () => {
execTestScript(`pw.expect(${i}).toBeLevel5xx()`, fakeResponse)()
).resolves.toEqualRight([
expect.objectContaining({
expectResults: [{
status: "pass",
message: `Expected '${i}' to be 500-level status`,
}],
expectResults: [
{
status: "pass",
message: `Expected '${i}' to be 500-level status`,
},
],
}),
])
}
@@ -294,10 +337,12 @@ describe("toBeLevel5xx", () => {
execTestScript(`pw.expect(${i}).toBeLevel5xx()`, fakeResponse)()
).resolves.toEqualRight([
expect.objectContaining({
expectResults: [{
status: "fail",
message: `Expected '${i}' to be 500-level status`,
}],
expectResults: [
{
status: "fail",
message: `Expected '${i}' to be 500-level status`,
},
],
}),
])
}
@@ -308,11 +353,14 @@ describe("toBeLevel5xx", () => {
execTestScript(`pw.expect("foo").toBeLevel5xx()`, fakeResponse)()
).resolves.toEqualRight([
expect.objectContaining({
expectResults: [{
status: "error",
message: "Expected 500-level status but could not parse value 'foo'",
}],
})
expectResults: [
{
status: "error",
message:
"Expected 500-level status but could not parse value 'foo'",
},
],
}),
])
})
@@ -322,10 +370,12 @@ describe("toBeLevel5xx", () => {
execTestScript(`pw.expect(${i}).not.toBeLevel5xx()`, fakeResponse)()
).resolves.toEqualRight([
expect.objectContaining({
expectResults: [{
status: "fail",
message: `Expected '${i}' to not be 500-level status`,
}],
expectResults: [
{
status: "fail",
message: `Expected '${i}' to not be 500-level status`,
},
],
}),
])
}
@@ -337,10 +387,12 @@ describe("toBeLevel5xx", () => {
execTestScript(`pw.expect(${i}).not.toBeLevel5xx()`, fakeResponse)()
).resolves.toEqualRight([
expect.objectContaining({
expectResults: [{
status: "pass",
message: `Expected '${i}' to not be 500-level status`,
}],
expectResults: [
{
status: "pass",
message: `Expected '${i}' to not be 500-level status`,
},
],
}),
])
}
@@ -351,11 +403,14 @@ describe("toBeLevel5xx", () => {
execTestScript(`pw.expect("foo").not.toBeLevel5xx()`, fakeResponse)()
).resolves.toEqualRight([
expect.objectContaining({
expectResults: [{
status: "error",
message: "Expected 500-level status but could not parse value 'foo'",
}],
})
expectResults: [
{
status: "error",
message:
"Expected 500-level status but could not parse value 'foo'",
},
],
}),
])
})
})
})

View File

@@ -3,7 +3,7 @@ import { execTestScript, TestResponse } from "../../../test-runner"
const fakeResponse: TestResponse = {
status: 200,
body: "hoi",
headers: []
headers: [],
}
describe("toBeType", () => {
@@ -16,16 +16,23 @@ describe("toBeType", () => {
pw.expect(true).toBeType("boolean")
pw.expect({}).toBeType("object")
pw.expect(undefined).toBeType("undefined")
`, fakeResponse
`,
fakeResponse
)()
).resolves.toEqualRight([
expect.objectContaining({
expectResults: [
{ status: "pass", message: `Expected '2' to be type 'number'` },
{ status: "pass", message: `Expected '2' to be type 'number'` },
{ status: "pass", message: `Expected '2' to be type 'string'` },
{ status: "pass", message: `Expected 'true' to be type 'boolean'` },
{ status: "pass", message: `Expected '[object Object]' to be type 'object'` },
{ status: "pass", message: `Expected 'undefined' to be type 'undefined'` },
{
status: "pass",
message: `Expected '[object Object]' to be type 'object'`,
},
{
status: "pass",
message: `Expected 'undefined' to be type 'undefined'`,
},
],
}),
])
@@ -46,11 +53,17 @@ describe("toBeType", () => {
).resolves.toEqualRight([
expect.objectContaining({
expectResults: [
{ status: "fail", message: `Expected '2' to be type 'string'`},
{ status: "fail", message: `Expected '2' to be type 'number'`},
{ status: "fail", message: `Expected 'true' to be type 'string'`},
{ status: "fail", message: `Expected '[object Object]' to be type 'number'`},
{ status: "fail", message: `Expected 'undefined' to be type 'number'`},
{ status: "fail", message: `Expected '2' to be type 'string'` },
{ status: "fail", message: `Expected '2' to be type 'number'` },
{ status: "fail", message: `Expected 'true' to be type 'string'` },
{
status: "fail",
message: `Expected '[object Object]' to be type 'number'`,
},
{
status: "fail",
message: `Expected 'undefined' to be type 'number'`,
},
],
}),
])
@@ -65,16 +78,26 @@ describe("toBeType", () => {
pw.expect(true).not.toBeType("boolean")
pw.expect({}).not.toBeType("object")
pw.expect(undefined).not.toBeType("undefined")
`, fakeResponse
`,
fakeResponse
)()
).resolves.toEqualRight([
expect.objectContaining({
expectResults: [
{ status: "fail", message: `Expected '2' to not be type 'number'` },
{ status: "fail", message: `Expected '2' to not be type 'string'` },
{ status: "fail", message: `Expected 'true' to not be type 'boolean'` },
{ status: "fail", message: `Expected '[object Object]' to not be type 'object'` },
{ status: "fail", message: `Expected 'undefined' to not be type 'undefined'` },
{
status: "fail",
message: `Expected 'true' to not be type 'boolean'`,
},
{
status: "fail",
message: `Expected '[object Object]' to not be type 'object'`,
},
{
status: "fail",
message: `Expected 'undefined' to not be type 'undefined'`,
},
],
}),
])
@@ -97,9 +120,18 @@ describe("toBeType", () => {
expectResults: [
{ status: "pass", message: `Expected '2' to not be type 'string'` },
{ status: "pass", message: `Expected '2' to not be type 'number'` },
{ status: "pass", message: `Expected 'true' to not be type 'string'` },
{ status: "pass", message: `Expected '[object Object]' to not be type 'number'` },
{ status: "pass", message: `Expected 'undefined' to not be type 'number'` },
{
status: "pass",
message: `Expected 'true' to not be type 'string'`,
},
{
status: "pass",
message: `Expected '[object Object]' to not be type 'number'`,
},
{
status: "pass",
message: `Expected 'undefined' to not be type 'number'`,
},
],
}),
])
@@ -120,13 +152,28 @@ describe("toBeType", () => {
).resolves.toEqualRight([
expect.objectContaining({
expectResults: [
{ status: "error", message: `Argument for toBeType should be "string", "boolean", "number", "object", "undefined", "bigint", "symbol" or "function"` },
{ status: "error", message: `Argument for toBeType should be "string", "boolean", "number", "object", "undefined", "bigint", "symbol" or "function"` },
{ status: "error", message: `Argument for toBeType should be "string", "boolean", "number", "object", "undefined", "bigint", "symbol" or "function"` },
{ status: "error", message: `Argument for toBeType should be "string", "boolean", "number", "object", "undefined", "bigint", "symbol" or "function"` },
{ status: "error", message: `Argument for toBeType should be "string", "boolean", "number", "object", "undefined", "bigint", "symbol" or "function"` },
]
})
{
status: "error",
message: `Argument for toBeType should be "string", "boolean", "number", "object", "undefined", "bigint", "symbol" or "function"`,
},
{
status: "error",
message: `Argument for toBeType should be "string", "boolean", "number", "object", "undefined", "bigint", "symbol" or "function"`,
},
{
status: "error",
message: `Argument for toBeType should be "string", "boolean", "number", "object", "undefined", "bigint", "symbol" or "function"`,
},
{
status: "error",
message: `Argument for toBeType should be "string", "boolean", "number", "object", "undefined", "bigint", "symbol" or "function"`,
},
{
status: "error",
message: `Argument for toBeType should be "string", "boolean", "number", "object", "undefined", "bigint", "symbol" or "function"`,
},
],
}),
])
})
@@ -145,13 +192,28 @@ describe("toBeType", () => {
).resolves.toEqualRight([
expect.objectContaining({
expectResults: [
{ status: "error", message: `Argument for toBeType should be "string", "boolean", "number", "object", "undefined", "bigint", "symbol" or "function"` },
{ status: "error", message: `Argument for toBeType should be "string", "boolean", "number", "object", "undefined", "bigint", "symbol" or "function"` },
{ status: "error", message: `Argument for toBeType should be "string", "boolean", "number", "object", "undefined", "bigint", "symbol" or "function"` },
{ status: "error", message: `Argument for toBeType should be "string", "boolean", "number", "object", "undefined", "bigint", "symbol" or "function"` },
{ status: "error", message: `Argument for toBeType should be "string", "boolean", "number", "object", "undefined", "bigint", "symbol" or "function"` },
]
})
{
status: "error",
message: `Argument for toBeType should be "string", "boolean", "number", "object", "undefined", "bigint", "symbol" or "function"`,
},
{
status: "error",
message: `Argument for toBeType should be "string", "boolean", "number", "object", "undefined", "bigint", "symbol" or "function"`,
},
{
status: "error",
message: `Argument for toBeType should be "string", "boolean", "number", "object", "undefined", "bigint", "symbol" or "function"`,
},
{
status: "error",
message: `Argument for toBeType should be "string", "boolean", "number", "object", "undefined", "bigint", "symbol" or "function"`,
},
{
status: "error",
message: `Argument for toBeType should be "string", "boolean", "number", "object", "undefined", "bigint", "symbol" or "function"`,
},
],
}),
])
})
})

View File

@@ -3,7 +3,7 @@ import { execTestScript, TestResponse } from "../../../test-runner"
const fakeResponse: TestResponse = {
status: 200,
body: "hoi",
headers: []
headers: [],
}
describe("toHaveLength", () => {
@@ -20,7 +20,7 @@ describe("toHaveLength", () => {
expect.objectContaining({
expectResults: [
{ status: "pass", message: "Expected the array to be of length '4'" },
{ status: "pass", message: "Expected the array to be of length '0'" },
{ status: "pass", message: "Expected the array to be of length '0'" },
],
}),
])
@@ -57,8 +57,14 @@ describe("toHaveLength", () => {
).resolves.toEqualRight([
expect.objectContaining({
expectResults: [
{ status: "fail", message: "Expected the array to not be of length '4'" },
{ status: "fail", message: "Expected the array to not be of length '0'" },
{
status: "fail",
message: "Expected the array to not be of length '4'",
},
{
status: "fail",
message: "Expected the array to not be of length '0'",
},
],
}),
])
@@ -76,8 +82,14 @@ describe("toHaveLength", () => {
).resolves.toEqualRight([
expect.objectContaining({
expectResults: [
{ status: "pass", message: "Expected the array to not be of length '4'" },
{ status: "pass", message: "Expected the array to not be of length '0'" },
{
status: "pass",
message: "Expected the array to not be of length '4'",
},
{
status: "pass",
message: "Expected the array to not be of length '0'",
},
],
}),
])
@@ -95,10 +107,18 @@ describe("toHaveLength", () => {
).resolves.toEqualRight([
expect.objectContaining({
expectResults: [
{ status: "error", message: "Expected toHaveLength to be called for an array or string" },
{ status: "error", message: "Expected toHaveLength to be called for an array or string" },
]
})
{
status: "error",
message:
"Expected toHaveLength to be called for an array or string",
},
{
status: "error",
message:
"Expected toHaveLength to be called for an array or string",
},
],
}),
])
})
@@ -114,10 +134,18 @@ describe("toHaveLength", () => {
).resolves.toEqualRight([
expect.objectContaining({
expectResults: [
{ status: "error", message: "Expected toHaveLength to be called for an array or string" },
{ status: "error", message: "Expected toHaveLength to be called for an array or string" },
]
})
{
status: "error",
message:
"Expected toHaveLength to be called for an array or string",
},
{
status: "error",
message:
"Expected toHaveLength to be called for an array or string",
},
],
}),
])
})
@@ -132,9 +160,12 @@ describe("toHaveLength", () => {
).resolves.toEqualRight([
expect.objectContaining({
expectResults: [
{ status: "error", message: "Argument for toHaveLength should be a number" },
{
status: "error",
message: "Argument for toHaveLength should be a number",
},
],
})
}),
])
})
@@ -149,9 +180,12 @@ describe("toHaveLength", () => {
).resolves.toEqualRight([
expect.objectContaining({
expectResults: [
{ status: "error", message: "Argument for toHaveLength should be a number" },
{
status: "error",
message: "Argument for toHaveLength should be a number",
},
],
})
}),
])
})
})

View File

@@ -3,7 +3,7 @@ import { execTestScript, TestResponse } from "../../test-runner"
const fakeResponse: TestResponse = {
status: 200,
body: "hoi",
headers: []
headers: [],
}
describe("execTestScript function behavior", () => {
@@ -21,7 +21,7 @@ describe("execTestScript function behavior", () => {
`,
fakeResponse
)()
).resolves.toBeRight();
).resolves.toBeRight()
})
test("resolves for tests with failed expectations", () => {
@@ -35,7 +35,8 @@ describe("execTestScript function behavior", () => {
pw.expect(size * 4).toBe(4000);
pw.expect(size / 4).not.toBe(250);
});
`, fakeResponse
`,
fakeResponse
)()
).resolves.toBeRight()
})
@@ -52,7 +53,8 @@ describe("execTestScript function behavior", () => {
pw.expect(size * 4).toBe(4000);
pw.expect(size / 4).not.toBe(250);
});
`, fakeResponse
`,
fakeResponse
)()
).resolves.toBeLeft()
})