Skip to content

Commit fbfb822

Browse files
committed
the mock to use require(rdflib) instead of ES6 imports, which avoids Jest mock interception.
1 parent 2957b33 commit fbfb822

1 file changed

Lines changed: 35 additions & 46 deletions

File tree

__mocks__/rdflib.ts

Lines changed: 35 additions & 46 deletions
Original file line numberDiff line numberDiff line change
@@ -1,52 +1,41 @@
11
// @@ TODO: Remove currently untyped methods as they are added
22

3-
import { IndexedFormula } from 'rdflib/lib/index.js'
3+
// Use require() to load the actual rdflib module, bypassing Jest mock interception
4+
// eslint-disable-next-line @typescript-eslint/no-require-imports
5+
const rdflib = require('rdflib')
46

5-
export {
6-
BlankNode,
7-
Collection,
8-
convert,
9-
DataFactory,
10-
Empty,
11-
Formula,
12-
// Store, // Not currently supported in @types/rdflib
13-
// jsonParser, // Not currently supported in @types/rdflib
14-
Literal,
15-
log,
16-
// N3Parser, // Not currently supported in @types/rdflib
17-
NamedNode,
18-
Namespace,
19-
Node,
20-
parse,
21-
Query,
22-
// queryToSPARQL, // Not currently supported in @types/rdflib
23-
// RDFaProcessor, // Not currently supported in @types/rdflib
24-
// RDFParser, // Not currently supported in @types/rdflib
25-
// serialize, // Not currently supported in @types/rdflib
26-
// Serializer, // Not currently supported in @types/rdflib
27-
// SPARQLToQuery, // Not currently supported in @types/rdflib
28-
// sparqlUpdateParser, // Not currently supported in @types/rdflib
29-
Statement,
30-
term,
31-
// UpdatesSocket, // Not currently supported in @types/rdflib
32-
// UpdatesVia, // Not currently supported in @types/rdflib
33-
uri,
34-
Util,
35-
Variable,
36-
NextId,
37-
fromNT,
38-
graph,
39-
lit,
40-
st,
41-
namedNode as sym,
42-
blankNode,
43-
defaultGraph,
44-
literal,
45-
namedNode,
46-
quad,
47-
triple,
48-
variable
49-
} from 'rdflib/lib/index.js'
7+
export const IndexedFormula = rdflib.IndexedFormula
8+
export const BlankNode = rdflib.BlankNode
9+
export const Collection = rdflib.Collection
10+
export const convert = rdflib.convert
11+
export const DataFactory = rdflib.DataFactory
12+
export const Empty = rdflib.Empty
13+
export const Formula = rdflib.Formula
14+
export const Literal = rdflib.Literal
15+
export const log = rdflib.log
16+
export const NamedNode = rdflib.NamedNode
17+
export const Namespace = rdflib.Namespace
18+
export const Node = rdflib.Node
19+
export const parse = rdflib.parse
20+
export const Query = rdflib.Query
21+
export const Statement = rdflib.Statement
22+
export const term = rdflib.term
23+
export const uri = rdflib.uri
24+
export const Util = rdflib.Util
25+
export const Variable = rdflib.Variable
26+
export const NextId = rdflib.NextId
27+
export const fromNT = rdflib.fromNT
28+
export const graph = rdflib.graph
29+
export const lit = rdflib.lit
30+
export const st = rdflib.st
31+
export const sym = rdflib.namedNode
32+
export const blankNode = rdflib.blankNode
33+
export const defaultGraph = rdflib.defaultGraph
34+
export const literal = rdflib.literal
35+
export const namedNode = rdflib.namedNode
36+
export const quad = rdflib.quad
37+
export const triple = rdflib.triple
38+
export const variable = rdflib.variable
5039

5140
export function fetcher (store: any) {
5241
const fetcher = new Fetcher()

0 commit comments

Comments
 (0)