In order to make developer live easier there are shorhands for all test function
There is bs_const variable - insertKopytkoUnitTestSuiteArgument
- when true all test case functions and hooks need ts (TestSuite) argument
it("should check if true is true", function (_ts as Object) as String
return expect(true).toBeTrue()
end function)- when false all test case functions and hooks do not need ts (TestSuite) argument
it("should check if true is true", function () as String
return expect(true).toBeTrue()
end function)This is a shorthand for the ts.addTest.
test("it should check if true is true", function (_ts as Object) as String
return expect(true).toBeTrue()
end function)This is a shorthand for the ts.addParameterizedTests.
testEach([
{ value: 2, expectedValue: 2 },
{ value: "asd", expectedValue: "asd" },
], "it should check if ${value} is ${expectedValue}", function (_ts as Object, params as Object) as String
return expect(params.value).toBe(params.expectedValue)
end function)This is a shorthand for the ts.addTest.
It adds "it " to the beggining of the test name.
it("should check if true is true", function (_ts as Object) as String
return expect(true).toBeTrue()
end function)This is a shorthand for the ts.addParameterizedTests.
It adds "it " to the beggining of the test name.
itEach([
{ value: 2, expectedValue: 2 },
{ value: "asd", expectedValue: "asd" },
], "should check if ${value} is ${expectedValue}", function (_ts as Object, params as Object) as String
return expect(params.value).toBe(params.expectedValue)
end function)This is a shorthand for the ts.setBeforeAll.
beforeAll(sub (_ts as Object)
? "This will be printed before first test case execution"
end sub)This is a shorthand for the ts.setBeforeEach.
beforeEach(sub (_ts as Object)
? "This will be printed before every test case execution"
end sub)This is a shorthand for the ts.setAfterEach.
afterEach(sub (_ts as Object)
? "This will be printed after every test case execution"
end sub)This is a shorthand for the ts.setAfterAll.
afterAll(sub (_ts as Object)
? "This will be printed after last test case execution"
end sub)Returns Test Suite object (ts).
ts().isMatch({ a: 1 }, { a: 1 })