Skip to content

Commit

Permalink
Prepare initial development release
Browse files Browse the repository at this point in the history
  • Loading branch information
t-ski committed Jul 27, 2024
1 parent f4836bd commit f2917ac
Show file tree
Hide file tree
Showing 45 changed files with 2,535 additions and 112 deletions.
3 changes: 1 addition & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,4 @@ types/

packages/@__generated/

.DS_Store
package-lock.json
.DS_Store
1 change: 0 additions & 1 deletion .husky/pre-commit
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
npm run build
npm run test

npx lint-staged
10 changes: 5 additions & 5 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
Context-sensitive, (a)sync-uniform testing framework for JavaScript and TypeScript.

``` cli
npm install -D rapidjs-org/test
npm install -D rapidjs-org/testing
```

<sub>division.test.js</sub>
Expand All @@ -29,8 +29,8 @@ new UnitTest("Throws error for division by zero")

| Alias &thinsp; <sub>Underlying Package</sub> | Test Class | Purpose |
| :- | :- | :- |
| `unit` &thinsp; <sub>`rapidjs-org/test--unit`</sub> | `UnitTest` | Unit testing <sup>([Read Documentation](./packages/@unit/README.md))</sup> |
| `http` &thinsp; <sub>`rapidjs-org/test--http`</sub> | `HTTPTest` | HTTP(S) testing <sup>([Read Documentation](./packages/@http/README.md))</sup> |
| `unit` &thinsp; <sub>`rapidjs-org/testing--unit`</sub> | `UnitTest` | Unit testing <sup>([Read Documentation](./packages/@unit/README.md))</sup> |
| `http` &thinsp; <sub>`rapidjs-org/testing--http`</sub> | `HTTPTest` | HTTP(S) testing <sup>([Read Documentation](./packages/@http/README.md))</sup> |

## Test Cases

Expand Down Expand Up @@ -221,7 +221,7 @@ For convenience, rJS Test allows the actual and the expected expressions to devi
#### Difference Helper
Whether or not a test case is successful depends on the difference computed from the actual and expected expression evaluations. rJS Test does not simply implement a method that checks for contextual equality, but combines display values filtering with an implicit equality check. The difference is hence not (necessarily) the mathematical difference operation, but a production of the actual and expected value to print in case they do not match. Precisely speaking, a test case fails if the partially returned difference values (`.actual` or `.expected`) are not equal (`===`) or at least one is not empty. Emptiness is moreover defined as any value that is `undefined`, `null` or an empty object `{}` (has no abstract properties). By default, the entire values are reflected in case they are not deep equal (non-strict).
Whether or not a test case is successful depends on the difference computed from the actual and expected expression evaluations through `getDifference()`. rJS Test does not simply implement a method that checks for contextual equality, but combines display values filtering with an implicit equality check. The difference is hence not (necessarily) the mathematical difference operation, but a production of the actual and expected value to print in case they do not match. Precisely speaking, a test case fails if the partially returned difference values (`.actual` or `.expected`) are not equal (`===`) or at least one is not empty. Emptiness is moreover defined as any value that is `undefined`, `null` or an empty object `{}` (has no abstract properties). By default, the entire values are reflected in case they are not deep equal (non-strict).
## API
Expand Down Expand Up @@ -253,7 +253,7 @@ interface IResults {
#### Example
``` ts
import rJS Test from "rapidjs-org/test";
import rJS Test from "rapidjs-org/testing";

rJS Test.init("unit", require("path").resolve("./test/"))
.then(results => {
Expand Down
4 changes: 2 additions & 2 deletions bin.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash


[ ! -d ./packages/test/build ] && npm run debug
[ ! -d ./packages/testing/build ] && npm run build

node ./packages/test/build/cli/cli.js $@
node $(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)/packages/testing/build/cli/cli.js $@
2 changes: 1 addition & 1 deletion examples/http/lib/rest.service.js
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ module.exports.listen = function(port) {
return new Promise(resolve => {
server = APP.listen(port, () => {
console.log(`REST API listening on port ${port}`);

resolve();
});
});
Expand Down
2 changes: 1 addition & 1 deletion examples/unit/analog.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -10,4 +10,4 @@ new UnitTest("Tolerance")

new UnitTest("Not equal")
.actual(REF !== 1)
.expected(true);
.expected(false);
2 changes: 1 addition & 1 deletion metatest/http/__test.env.js
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ module.exports.BEFORE = function() {
return;
}
}

end(null, 404);
})
.listen(7979, () => {
Expand Down
14 changes: 3 additions & 11 deletions metatest/http/http-1.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,10 @@ new HTTPTest("Get movies")
body: movieData.MOVIES.concat(movieData.NEW_MOVIE)
});

// TODO: Errors?

/* new HTTPTest("Create movie")
.post(movieData.MOVIES_PATH, {
name: "Husky"
})
.expected(200);
new HTTPTest("Get movies")
.actual(movieData.MOVIES_PATH, {
headers: {
"Accept-Language": "en;q=1.0, de;q=0.75, *;q=0.5"
}
})
.expected("abc"); */

// TODO: Error
.expected(200); */
Loading

0 comments on commit f2917ac

Please sign in to comment.