nodeSolidServer / node-solid-server

Solid server on top of the file-system in NodeJS
https://solidproject.org/for-developers/pod-server
Other
1.78k stars 298 forks source link

JSON-LD related tests failing in update-deps branch #1455

Closed michielbdejong closed 4 years ago

michielbdejong commented 4 years ago

Set up your mashlib-dev with the update-deps branches of node-solid-server and of rdflib. Run npx lerna bootstrap --force-local so they link up, and then in ./workspaces/node-solid-server, run:

DEBUG=* ./node_modules/.bin/mocha  test/integration/formats-test.js

You'll see 3 out of 4 JSON-LD tests failing:


formats
    JSON-LD
      1) should return JSON-LD document if Accept is set to only application/ld+json
      2) should return the container listing in JSON-LD if Accept is set to only application/ld+json
      ✓ should prefer to avoid translation even if type is listed with less priority
      3) should return JSON-LD document if Accept is set to application/ld+json and other types
michielbdejong commented 4 years ago

Running npm run watch for rdflib in a separate window, I'm seeing it hit https://github.com/linkeddata/rdflib.js/blob/update-deps/src/convert.js#L25-L27. When trying it in the REPL, I can't reproduce the error that gets thrown there:

node
Welcome to Node.js v12.18.0.
Type ".help" for more information.
> require('jsonld').fromRDF("<https://localhost:8443/patch-5-initial.ttl#Iss1408851516666> <http://www.w3.org/2005/01/wf/flow#assignee> <https://localhost:8443/patch-5-initial.ttl#TBL> .\n<https://localhost:8443/patch-5-initial.ttl#Iss1408851516666> <https://localhost:8443/patch-5-initial.ttl#ppp> \"123\"^^<http://www.w3.org/2001/XMLSchema#integer> .\n", { format: 'application/nquads' }, (err, result) => { console.log({ err, result: JSON.stringify(result) }) })
undefined
> {
  err: null,
  result: '[{"@id":"https://localhost:8443/patch-5-initial.ttl#Iss1408851516666","http://www.w3.org/2005/01/wf/flow#assignee":[{"@id":"https://localhost:8443/patch-5-initial.ttl#TBL"}],"https://localhost:8443/patch-5-initial.ttl#ppp":[{"@value":"123","@type":"http://www.w3.org/2001/XMLSchema#integer"}]}]'
}

> 
michielbdejong commented 4 years ago

Ah, using the Promise interface for jsonld.fromRDF fixes the test.

michielbdejong commented 4 years ago

Fixed in https://github.com/linkeddata/rdflib.js/commit/44c269ce46f3fd125d76198c3fea2905c4b5bb87.