Test for toBeLevel2xx()
This commit is contained in:
parent
7d08da22b2
commit
3614f5b620
1 changed files with 22 additions and 0 deletions
|
|
@ -62,3 +62,25 @@ describe("toHaveProperty", () => {
|
|||
).toEqual(FAIL)
|
||||
})
|
||||
})
|
||||
|
||||
describe("toBeLevel2xx", () => {
|
||||
test("test for numbers", () => {
|
||||
expect(getTestResult("pw.expect(200).toBeLevel2xx()", 0)).toEqual(PASS)
|
||||
expect(getTestResult("pw.expect(200).not.toBeLevel2xx()", 0)).toEqual(FAIL)
|
||||
expect(getTestResult("pw.expect(300).toBeLevel2xx()", 0)).toEqual(FAIL)
|
||||
expect(getTestResult("pw.expect(300).not.toBeLevel2xx()", 0)).toEqual(PASS)
|
||||
})
|
||||
test("test for strings", () => {
|
||||
expect(getTestResult("pw.expect('200').toBeLevel2xx()", 0)).toEqual(PASS)
|
||||
expect(getTestResult("pw.expect('200').not.toBeLevel2xx()", 0)).toEqual(FAIL)
|
||||
expect(getTestResult("pw.expect('300').toBeLevel2xx()", 0)).toEqual(FAIL)
|
||||
expect(getTestResult("pw.expect('300').not.toBeLevel2xx()", 0)).toEqual(PASS)
|
||||
})
|
||||
test("failed to parse to integer", () => {
|
||||
expect(getTestResult("pw.expect(undefined).toBeLevel2xx()", 0)).toEqual(FAIL)
|
||||
expect(getTestResult("pw.expect(null).toBeLevel2xx()", 0)).toEqual(FAIL)
|
||||
expect(() => {
|
||||
runTestScriptWithVariables("pw.expect(Symbol('test')).toBeLevel2xx()")
|
||||
}).toThrow()
|
||||
})
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in a new issue