Closed crookse closed 2 years ago
Closes #75
Clone the repo.
$ git clone https://github.com/drashland/rhum.git $ git checkout rhum-v2
Install Rhum.
$ deno install --allow-read --allow-run -f ./cli.ts
Display help menu.
$ rhum
--allow-write
--allow-net
Directly states where the assertion error occurred (e.g., test file name, line, and column)
tests/integration/asserts_test.ts Deno std asserts PASS asserts FAIL assertEquals The following error occurred in: asserts_test.ts:9:20 AssertionError: Values are not equal: [Diff] Actual / Expected - false + true Test Results: 8 passed; 1 failed; 0 skipped
mock.methods.{someMethod}.wasLastCalledWith([arg1, arg2, etc.])
const mockMathService = Rhum .mock(MathService) .create(); mockMathService.add(1, 1); Rhum.asserts.assert( mockMathService.methods.add.wasLastCalledWith([1, 1]), ); mockMathService.add(2, 1); Rhum.asserts.assert( mockMathService.methods.add.wasLastCalledWith([2, 1]), );
mock.methods.{someMethod}.wasCalledTimes(numberOfTimes)
const mockMathService = Rhum .mock(MathService) .create(); const mockTestObject = Rhum .mock(TestObject) .withConstructorArgs("has mocked math service", mockMathService) .create(); Rhum.asserts.assert(mockMathService.methods.add.wasCalledTimes(0)); mockTestObject.sum(1, 1); // calls mockMathService.add(1, 1) Rhum.asserts.assert(mockMathService.methods.add.wasCalledTimes(1));
mock.methods.{someMethod}.lastReturned(returnValue)
const mockMathService = Rhum .mock(MathService) .create(); mockMathService.add(1, 1); Rhum.asserts.assert( mockMathService.methods.add.lastReturned(2), ); mockMathService.add(2, 1); Rhum.asserts.assert( mockMathService.methods.add.lastReturned(3), );
ServerRequest
mock.calls
console/bumper_ci_service.ts
wil the cli code be removed from this pr?
not doing this anymore. v2 will be a test double framework
Closes #75
Dependency
About
Usage
Clone the repo.
Install Rhum.
Display help menu.
Features
--allow-write
,--allow-net
)Directly states where the assertion error occurred (e.g., test file name, line, and column)
mock.methods.{someMethod}.wasLastCalledWith([arg1, arg2, etc.])
mock.methods.{someMethod}.wasCalledTimes(numberOfTimes)
mock.methods.{someMethod}.lastReturned(returnValue)
Removes
ServerRequest
mockmock.calls
Chores
console/bumper_ci_service.ts
)Example output
CI output