Skip to content

Commit

Permalink
Add blank node system test.
Browse files Browse the repository at this point in the history
Closes #34
  • Loading branch information
RubenVerborgh committed Jun 1, 2020
1 parent 7ce5077 commit fb07664
Show file tree
Hide file tree
Showing 2 changed files with 169 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,141 @@
{
"log": {
"_recordingName": "System test: blank nodes/Alice's friends with one expression",
"creator": {
"comment": "persister:fs",
"name": "Polly.JS",
"version": "4.1.0"
},
"entries": [
{
"_id": "e0158368a4527e1173c6c7e213eec436",
"_order": 0,
"cache": {},
"request": {
"bodySize": 0,
"cookies": [],
"headers": [
{
"_fromType": "array",
"name": "accept",
"value": "application/n-quads,application/trig;q=0.95,application/ld+json;q=0.9,application/n-triples;q=0.8,text/turtle;q=0.5,application/rdf+xml;q=0.5,application/json;q=0.45,text/n3;q=0.35,application/xml;q=0.3,text/xml;q=0.3,image/svg+xml;q=0.3,text/html;q=0.2,application/xhtml+xml;q=0.18"
},
{
"_fromType": "array",
"name": "accept-encoding",
"value": "gzip,deflate"
},
{
"_fromType": "array",
"name": "user-agent",
"value": "node-fetch/1.0 (+https://github.com/bitinn/node-fetch)"
},
{
"_fromType": "array",
"name": "connection",
"value": "close"
},
{
"name": "host",
"value": "drive.verborgh.org"
}
],
"headersSize": 502,
"httpVersion": "HTTP/1.1",
"method": "GET",
"queryString": [],
"url": "https://drive.verborgh.org/public/2019/blanks.ttl"
},
"response": {
"bodySize": 334,
"content": {
"mimeType": "text/turtle",
"size": 334,
"text": "[\"1f8b08000000000000037328284a4dcbac5048cb4f4cb352b0c9282929b0d2d7afc8cdc92bd64bcecfd50789eb1be819eadbe97171d9283be66426a7da4154e725e6a62a28814594acb91460006c52765e7e79b14234b242a7fc242585581d84429806208da2d039b1283f07a81461a111a68d46c85642ac81d869a30cb4c8c80ebb3d0a36ca60d38d80be812a4473a291124806aa08590e22a4a40700ff2c320531010000\"]"
},
"cookies": [],
"headers": [
{
"name": "date",
"value": "Sat, 25 Apr 2020 21:45:20 GMT"
},
{
"name": "content-type",
"value": "text/turtle"
},
{
"name": "transfer-encoding",
"value": "chunked"
},
{
"name": "connection",
"value": "close"
},
{
"name": "vary",
"value": "Accept-Encoding, Accept, Authorization, Origin"
},
{
"name": "x-powered-by",
"value": "solid-server"
},
{
"name": "access-control-allow-credentials",
"value": "true"
},
{
"name": "access-control-expose-headers",
"value": "Authorization, User, Location, Link, Vary, Last-Modified, ETag, Accept-Patch, Accept-Post, Updates-Via, Allow, WAC-Allow, Content-Length, WWW-Authenticate"
},
{
"name": "allow",
"value": "OPTIONS, HEAD, GET, PATCH, POST, PUT, DELETE"
},
{
"name": "link",
"value": "<blanks.ttl.acl>; rel=\"acl\", <blanks.ttl.meta>; rel=\"describedBy\", <http://www.w3.org/ns/ldp#Resource>; rel=\"type\""
},
{
"name": "wac-allow",
"value": "user=\"read\",public=\"read\""
},
{
"name": "ms-author-via",
"value": "SPARQL"
},
{
"name": "updates-via",
"value": "wss://drive.verborgh.org"
},
{
"name": "strict-transport-security",
"value": "max-age=15768000"
},
{
"name": "content-encoding",
"value": "gzip"
}
],
"headersSize": 766,
"httpVersion": "HTTP/1.1",
"redirectURL": "",
"status": 200,
"statusText": "OK"
},
"startedDateTime": "2020-04-25T21:45:20.680Z",
"time": 226,
"timings": {
"blocked": -1,
"connect": -1,
"dns": -1,
"receive": 0,
"send": 0,
"ssl": -1,
"wait": 226
}
}
],
"pages": [],
"version": "1.2"
}
}
28 changes: 28 additions & 0 deletions test/system/blanks-test.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
import data from '../../src/exports/comunica.js';

jest.unmock('solid-auth-client');
import { mockHttp } from '../util';

const alice = 'https://drive.verborgh.org/public/2019/blanks.ttl#Alice';

describe('System test: blank nodes', () => {
mockHttp();

test('Alice\'s friends with one expression', async () => {
const names = [];
for await (const name of data[alice].friends.name)
names.push(`${name}`);
expect(names).toHaveLength(2);
expect(names).toContain('Bob');
expect(names).toContain('Carol');
});

test('Alice\'s friends with two expressions', async () => {
const names = [];
for await (const friend of data[alice].friends)
names.push(`${await friend.name}`);
expect(names).toHaveLength(2);
expect(names).toContain('Bob');
expect(names).toContain('Carol');
});
});

0 comments on commit fb07664

Please sign in to comment.