Test for toBeLevel3xx()

This commit is contained in:
Karel De Smet
2020-12-22 08:01:55 +01:00
parent 3614f5b620
commit d92412175c
2 changed files with 26 additions and 4 deletions

View File

@@ -84,3 +84,25 @@ describe("toBeLevel2xx", () => {
}).toThrow()
})
})
describe("toBeLevel3xx()", () => {
test("test for numbers", () => {
expect(getTestResult("pw.expect(300).toBeLevel3xx()", 0)).toEqual(PASS)
expect(getTestResult("pw.expect(300).not.toBeLevel3xx()", 0)).toEqual(FAIL)
expect(getTestResult("pw.expect(400).toBeLevel3xx()", 0)).toEqual(FAIL)
expect(getTestResult("pw.expect(400).not.toBeLevel3xx()", 0)).toEqual(PASS)
})
test("test for strings", () => {
expect(getTestResult("pw.expect('300').toBeLevel3xx()", 0)).toEqual(PASS)
expect(getTestResult("pw.expect('300').not.toBeLevel3xx()", 0)).toEqual(FAIL)
expect(getTestResult("pw.expect('400').toBeLevel3xx()", 0)).toEqual(FAIL)
expect(getTestResult("pw.expect('400').not.toBeLevel3xx()", 0)).toEqual(PASS)
})
test("failed to parse to integer", () => {
expect(getTestResult("pw.expect(undefined).toBeLevel3xx()", 0)).toEqual(FAIL)
expect(getTestResult("pw.expect(null).toBeLevel3xx()", 0)).toEqual(FAIL)
expect(() => {
runTestScriptWithVariables("pw.expect(Symbol('test')).toBeLevel3xx()")
}).toThrow()
})
})