@rdfx/testing 0.0.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.d.ts +18 -0
- package/dist/index.js +3 -0
- package/dist/matchers.d.ts +4 -0
- package/dist/matchers.js +7 -0
- package/dist/purifyMatchers.d.ts +3 -0
- package/dist/purifyMatchers.js +36 -0
- package/package.json +30 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
import type * as RDF from "@rdfjs/types";
|
|
2
|
+
import type { IQuadTerms } from "jest-rdf/lib/matchers/toBeRdfDatasetMatching.js";
|
|
3
|
+
import "vitest";
|
|
4
|
+
declare module "vitest" {
|
|
5
|
+
interface Matchers<T = any> {
|
|
6
|
+
toBeLeft(expected?: unknown): T;
|
|
7
|
+
toBeRdfDatasetContaining: (...actual: RDF.BaseQuad[]) => T;
|
|
8
|
+
toBeRdfDatasetMatching: (match: IQuadTerms<RDF.BaseQuad>, matches?: number) => T;
|
|
9
|
+
toBeRdfDatasetOfSize: (size: number) => T;
|
|
10
|
+
toBeRdfIsomorphic: (actual: Iterable<RDF.BaseQuad>) => T;
|
|
11
|
+
toEqualRdfQuad: (actual: RDF.BaseQuad) => T;
|
|
12
|
+
toEqualRdfQuadArray: (actual: RDF.BaseQuad[]) => T;
|
|
13
|
+
toEqualRdfTerm: (actual: RDF.Term) => T;
|
|
14
|
+
toEqualRdfTermArray: (actual: RDF.Term[]) => T;
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
export { matchers } from "./matchers.js";
|
|
18
|
+
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.js
ADDED
package/dist/matchers.js
ADDED
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
import { Either } from "purify-ts";
|
|
2
|
+
function toBeLeftStrict(context, received, expected) {
|
|
3
|
+
if (!received.isLeft()) {
|
|
4
|
+
return {
|
|
5
|
+
pass: false,
|
|
6
|
+
message: () => `expected a Left but received Right(${String(received.extract())})`,
|
|
7
|
+
};
|
|
8
|
+
}
|
|
9
|
+
if (expected !== undefined) {
|
|
10
|
+
const actual = received.extract();
|
|
11
|
+
const pass = context.equals(actual, expected);
|
|
12
|
+
return {
|
|
13
|
+
pass,
|
|
14
|
+
actual,
|
|
15
|
+
expected,
|
|
16
|
+
message: () => pass
|
|
17
|
+
? `expected Left(${String(actual)}) not to equal Left(${String(expected)})`
|
|
18
|
+
: `expected Left(${String(actual)}) to equal Left(${String(expected)})`,
|
|
19
|
+
};
|
|
20
|
+
}
|
|
21
|
+
return {
|
|
22
|
+
pass: true,
|
|
23
|
+
message: () => `expected not to be a Left`,
|
|
24
|
+
};
|
|
25
|
+
}
|
|
26
|
+
export const toBeLeft = function (received, // must be unknown here
|
|
27
|
+
expected) {
|
|
28
|
+
if (!Either.isEither(received)) {
|
|
29
|
+
return {
|
|
30
|
+
pass: false,
|
|
31
|
+
message: () => `expected an Either but received ${String(received)}`,
|
|
32
|
+
};
|
|
33
|
+
}
|
|
34
|
+
return toBeLeftStrict(this, received, expected);
|
|
35
|
+
};
|
|
36
|
+
//# sourceMappingURL=purifyMatchers.js.map
|
package/package.json
ADDED
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
{
|
|
2
|
+
"dependencies": {
|
|
3
|
+
"@rdfjs/types": "~2.0.1",
|
|
4
|
+
"jest-rdf": "~2.0.0",
|
|
5
|
+
"purify-ts": "~2.1.4",
|
|
6
|
+
"vitest": "~4.1.5"
|
|
7
|
+
},
|
|
8
|
+
"devDependencies": {},
|
|
9
|
+
"files": [
|
|
10
|
+
"dist/*.d.ts",
|
|
11
|
+
"dist/*.js"
|
|
12
|
+
],
|
|
13
|
+
"license": "Apache-2.0",
|
|
14
|
+
"main": "./dist/index.js",
|
|
15
|
+
"name": "@rdfx/testing",
|
|
16
|
+
"packageManager": "npm@11.11.0",
|
|
17
|
+
"repository": {
|
|
18
|
+
"type": "git",
|
|
19
|
+
"url": "git+https://github.com/minorg/rdfx.git"
|
|
20
|
+
},
|
|
21
|
+
"scripts": {
|
|
22
|
+
"build": "tsc -b",
|
|
23
|
+
"clean": "rimraf dist",
|
|
24
|
+
"depcheck": "depcheck .",
|
|
25
|
+
"dev": "tsc -w --preserveWatchOutput"
|
|
26
|
+
},
|
|
27
|
+
"type": "module",
|
|
28
|
+
"types": "./dist/index.d.ts",
|
|
29
|
+
"version": "0.0.3"
|
|
30
|
+
}
|