diff --git a/src/loaders.js b/src/loaders.js index 20277c9..0277ced 100644 --- a/src/loaders.js +++ b/src/loaders.js @@ -21,7 +21,7 @@ export default function createLoaders (client) { const lookup = new DataLoader(keys => { return Promise.all(keys.map(key => { - const [ entityType, id, params ] = key + const [ entityType, id, params = {} ] = key return client.lookup(entityType, id, params).then(entity => { if (entity) { // Store the entity type so we can determine what type of object this @@ -39,7 +39,7 @@ export default function createLoaders (client) { const browse = new DataLoader(keys => { return Promise.all(keys.map(key => { - const [ entityType, params ] = key + const [ entityType, params = {} ] = key return client.browse(entityType, params).then(list => { list[toPlural(entityType)].forEach(entity => { // Store the entity type so we can determine what type of object this @@ -57,7 +57,7 @@ export default function createLoaders (client) { const search = new DataLoader(keys => { return Promise.all(keys.map(key => { - const [ entityType, query, params ] = key + const [ entityType, query, params = {} ] = key return client.search(entityType, query, params).then(list => { list[toPlural(entityType)].forEach(entity => { // Store the entity type so we can determine what type of object this diff --git a/test/fixtures/05fcd912e8786fff4dca854a7fa44c81.headers b/test/fixtures/05fcd912e8786fff4dca854a7fa44c81.headers index 6874b25..666a732 100644 --- a/test/fixtures/05fcd912e8786fff4dca854a7fa44c81.headers +++ b/test/fixtures/05fcd912e8786fff4dca854a7fa44c81.headers @@ -1,22 +1,22 @@ { "statusCode": 200, "headers": { - "date": "Thu, 08 Dec 2016 22:10:36 GMT", + "date": "Thu, 08 Dec 2016 22:32:00 GMT", "content-type": "application/json; charset=UTF-8", "transfer-encoding": "chunked", "connection": "keep-alive", "keep-alive": "timeout=15", "vary": "Accept-Encoding", "x-ratelimit-limit": "700", - "x-ratelimit-remaining": "547", - "x-ratelimit-reset": "1481235037", + "x-ratelimit-remaining": "303", + "x-ratelimit-reset": "1481236321", "last-modified": "Wed, 09 Nov 2016 23:43:24 GMT", "server": "Jetty(9.3.10.v20160621)", "access-control-allow-origin": "*", "content-encoding": "gzip" }, "url": "http://musicbrainz.org:80/ws/2/recording?query=Burn%20the%20Witch&fmt=json", - "time": 604, + "time": 596, "request": { "method": "GET", "headers": { diff --git a/test/fixtures/157ce6484de07a7e2ee93b54e8244e27 b/test/fixtures/157ce6484de07a7e2ee93b54e8244e27 index 2ae7eed..a5e5de0 100644 Binary files a/test/fixtures/157ce6484de07a7e2ee93b54e8244e27 and b/test/fixtures/157ce6484de07a7e2ee93b54e8244e27 differ diff --git a/test/fixtures/157ce6484de07a7e2ee93b54e8244e27.headers b/test/fixtures/157ce6484de07a7e2ee93b54e8244e27.headers index f9ac62a..57781b2 100644 --- a/test/fixtures/157ce6484de07a7e2ee93b54e8244e27.headers +++ b/test/fixtures/157ce6484de07a7e2ee93b54e8244e27.headers @@ -1,22 +1,22 @@ { "statusCode": 200, "headers": { - "date": "Thu, 08 Dec 2016 22:10:38 GMT", + "date": "Thu, 08 Dec 2016 22:32:02 GMT", "content-type": "application/json; charset=UTF-8", "transfer-encoding": "chunked", "connection": "keep-alive", "keep-alive": "timeout=15", "vary": "Accept-Encoding", "x-ratelimit-limit": "700", - "x-ratelimit-remaining": "679", - "x-ratelimit-reset": "1481235039", - "last-modified": "Thu, 08 Dec 2016 21:32:00 GMT", + "x-ratelimit-remaining": "334", + "x-ratelimit-reset": "1481236323", + "last-modified": "Thu, 08 Dec 2016 22:03:30 GMT", "server": "Jetty(9.3.10.v20160621)", "access-control-allow-origin": "*", "content-encoding": "gzip" }, "url": "http://musicbrainz.org:80/ws/2/label?limit=1&query=Apple%20Records&fmt=json", - "time": 1473, + "time": 1539, "request": { "method": "GET", "headers": { diff --git a/test/fixtures/456168a862ec0ca28127f067e3f166e7 b/test/fixtures/456168a862ec0ca28127f067e3f166e7 index f4d156e..6bde522 100644 Binary files a/test/fixtures/456168a862ec0ca28127f067e3f166e7 and b/test/fixtures/456168a862ec0ca28127f067e3f166e7 differ diff --git a/test/fixtures/456168a862ec0ca28127f067e3f166e7.headers b/test/fixtures/456168a862ec0ca28127f067e3f166e7.headers index c25c596..50171de 100644 --- a/test/fixtures/456168a862ec0ca28127f067e3f166e7.headers +++ b/test/fixtures/456168a862ec0ca28127f067e3f166e7.headers @@ -1,22 +1,22 @@ { "statusCode": 200, "headers": { - "date": "Thu, 08 Dec 2016 22:10:35 GMT", + "date": "Thu, 08 Dec 2016 22:31:58 GMT", "content-type": "application/json; charset=utf-8", "transfer-encoding": "chunked", "connection": "keep-alive", "keep-alive": "timeout=15", "vary": "Accept-Encoding", "x-ratelimit-limit": "700", - "x-ratelimit-remaining": "250", - "x-ratelimit-reset": "1481235035", + "x-ratelimit-remaining": "180", + "x-ratelimit-reset": "1481236319", "server": "Plack::Handler::Starlet", - "etag": "W/\"39c7b86496389329f958f3d9d8599d32\"", + "etag": "W/\"15092bd7b55df20c4f8fd072b82a0f1f\"", "access-control-allow-origin": "*", "content-encoding": "gzip" }, "url": "http://musicbrainz.org:80/ws/2/artist/c8da2e40-bd28-4d4e-813a-bd2f51958ba8?fmt=json", - "time": 3316, + "time": 426, "request": { "method": "GET", "headers": { diff --git a/test/fixtures/6044ddc15443664659ef91c3c73c0776 b/test/fixtures/6044ddc15443664659ef91c3c73c0776 index ed6e425..48eca17 100644 Binary files a/test/fixtures/6044ddc15443664659ef91c3c73c0776 and b/test/fixtures/6044ddc15443664659ef91c3c73c0776 differ diff --git a/test/fixtures/6044ddc15443664659ef91c3c73c0776.headers b/test/fixtures/6044ddc15443664659ef91c3c73c0776.headers index f125c93..8d177cd 100644 --- a/test/fixtures/6044ddc15443664659ef91c3c73c0776.headers +++ b/test/fixtures/6044ddc15443664659ef91c3c73c0776.headers @@ -1,22 +1,22 @@ { "statusCode": 200, "headers": { - "date": "Thu, 08 Dec 2016 22:10:44 GMT", + "date": "Thu, 08 Dec 2016 22:32:06 GMT", "content-type": "application/json; charset=utf-8", "transfer-encoding": "chunked", "connection": "keep-alive", "keep-alive": "timeout=15", "vary": "Accept-Encoding", "x-ratelimit-limit": "700", - "x-ratelimit-remaining": "553", - "x-ratelimit-reset": "1481235045", + "x-ratelimit-remaining": "289", + "x-ratelimit-reset": "1481236327", "server": "Plack::Handler::Starlet", - "etag": "W/\"1bb5095802d059afef4624c8e955cac9\"", + "etag": "W/\"6a12c1ded7c7c8d9315107669601ed70\"", "access-control-allow-origin": "*", "content-encoding": "gzip" }, "url": "http://musicbrainz.org:80/ws/2/artist/300c4c73-33ac-4255-9d57-4e32627f5e13?inc=artist-rels&fmt=json", - "time": 2141, + "time": 556, "request": { "method": "GET", "headers": { diff --git a/test/fixtures/69d9c8738fe3ea4883276fd8fc9979ce b/test/fixtures/69d9c8738fe3ea4883276fd8fc9979ce index 775e601..71a1ef1 100644 Binary files a/test/fixtures/69d9c8738fe3ea4883276fd8fc9979ce and b/test/fixtures/69d9c8738fe3ea4883276fd8fc9979ce differ diff --git a/test/fixtures/69d9c8738fe3ea4883276fd8fc9979ce.headers b/test/fixtures/69d9c8738fe3ea4883276fd8fc9979ce.headers index 7b869a2..2b3032a 100644 --- a/test/fixtures/69d9c8738fe3ea4883276fd8fc9979ce.headers +++ b/test/fixtures/69d9c8738fe3ea4883276fd8fc9979ce.headers @@ -1,22 +1,22 @@ { "statusCode": 200, "headers": { - "date": "Thu, 08 Dec 2016 22:10:44 GMT", + "date": "Thu, 08 Dec 2016 22:32:06 GMT", "content-type": "application/json; charset=utf-8", "transfer-encoding": "chunked", "connection": "keep-alive", "keep-alive": "timeout=15", "vary": "Accept-Encoding", "x-ratelimit-limit": "700", - "x-ratelimit-remaining": "552", - "x-ratelimit-reset": "1481235045", + "x-ratelimit-remaining": "287", + "x-ratelimit-reset": "1481236327", "server": "Plack::Handler::Starlet", - "etag": "W/\"6ef3837bacadc37c2b7f98ef14494ffa\"", + "etag": "W/\"cfec247269cfa3680afeab36d412221c\"", "access-control-allow-origin": "*", "content-encoding": "gzip" }, "url": "http://musicbrainz.org:80/ws/2/artist/0d4ab0f9-bbda-4ab1-ae2c-f772ffcfbea9?inc=artist-rels&fmt=json", - "time": 2139, + "time": 517, "request": { "method": "GET", "headers": { diff --git a/test/fixtures/87438b239df73ddc020aee9ec9d84905 b/test/fixtures/87438b239df73ddc020aee9ec9d84905 new file mode 100644 index 0000000..6c2f78a --- /dev/null +++ b/test/fixtures/87438b239df73ddc020aee9ec9d84905 @@ -0,0 +1 @@ +{"primary-type":"Album","disambiguation":"","title":"Lures","secondary-types":[],"id":"e37d2740-4503-4e3f-ab6d-e622a25e964d","secondary-type-ids":[],"first-release-date":"2014-10-07","primary-type-id":"f529b476-6e62-324f-b0aa-1f3e33d313fc"} \ No newline at end of file diff --git a/test/fixtures/87438b239df73ddc020aee9ec9d84905.headers b/test/fixtures/87438b239df73ddc020aee9ec9d84905.headers new file mode 100644 index 0000000..06f9551 --- /dev/null +++ b/test/fixtures/87438b239df73ddc020aee9ec9d84905.headers @@ -0,0 +1,27 @@ +{ + "statusCode": 200, + "headers": { + "date": "Thu, 08 Dec 2016 22:32:00 GMT", + "content-type": "application/json; charset=utf-8", + "content-length": "240", + "connection": "keep-alive", + "keep-alive": "timeout=15", + "x-ratelimit-limit": "700", + "x-ratelimit-remaining": "504", + "x-ratelimit-reset": "1481236321", + "server": "Plack::Handler::Starlet", + "etag": "\"89bacb0f43473ab326be8f6ba1f42afd\"", + "access-control-allow-origin": "*" + }, + "url": "http://musicbrainz.org:80/ws/2/release-group/e37d2740-4503-4e3f-ab6d-e622a25e964d?fmt=json", + "time": 588, + "request": { + "method": "GET", + "headers": { + "User-Agent": "graphbrainz/3.1.0 ( https://github.com/exogen/graphbrainz )", + "host": "musicbrainz.org", + "accept-encoding": "gzip, deflate", + "accept": "application/json" + } + } +} \ No newline at end of file diff --git a/test/fixtures/9247bb00fc5e2e0dcf1fcd269df8b94e b/test/fixtures/9247bb00fc5e2e0dcf1fcd269df8b94e index 25c9e0a..8a3c6f9 100644 Binary files a/test/fixtures/9247bb00fc5e2e0dcf1fcd269df8b94e and b/test/fixtures/9247bb00fc5e2e0dcf1fcd269df8b94e differ diff --git a/test/fixtures/9247bb00fc5e2e0dcf1fcd269df8b94e.headers b/test/fixtures/9247bb00fc5e2e0dcf1fcd269df8b94e.headers index 2d4a9b8..c1f62d0 100644 --- a/test/fixtures/9247bb00fc5e2e0dcf1fcd269df8b94e.headers +++ b/test/fixtures/9247bb00fc5e2e0dcf1fcd269df8b94e.headers @@ -1,22 +1,22 @@ { "statusCode": 200, "headers": { - "date": "Thu, 08 Dec 2016 22:10:38 GMT", + "date": "Thu, 08 Dec 2016 22:32:05 GMT", "content-type": "application/json; charset=utf-8", "transfer-encoding": "chunked", "connection": "keep-alive", "keep-alive": "timeout=15", "vary": "Accept-Encoding", "x-ratelimit-limit": "700", - "x-ratelimit-remaining": "381", - "x-ratelimit-reset": "1481235039", + "x-ratelimit-remaining": "697", + "x-ratelimit-reset": "1481236327", "server": "Plack::Handler::Starlet", - "etag": "W/\"39e8c37928b3a6031027cd8ab314a49d\"", + "etag": "W/\"9020613941ca4d7631fab0e7d51d077f\"", "access-control-allow-origin": "*", "content-encoding": "gzip" }, "url": "http://musicbrainz.org:80/ws/2/release?label=cf7fc5cf-e011-4ef4-b511-cd0188537910&limit=1&fmt=json", - "time": 525, + "time": 390, "request": { "method": "GET", "headers": { diff --git a/test/fixtures/97ec62634d0a8953ab3ba2ffce984a83 b/test/fixtures/97ec62634d0a8953ab3ba2ffce984a83 index eadf9a2..edbc263 100644 Binary files a/test/fixtures/97ec62634d0a8953ab3ba2ffce984a83 and b/test/fixtures/97ec62634d0a8953ab3ba2ffce984a83 differ diff --git a/test/fixtures/97ec62634d0a8953ab3ba2ffce984a83.headers b/test/fixtures/97ec62634d0a8953ab3ba2ffce984a83.headers index 6bf43a7..cfa792b 100644 --- a/test/fixtures/97ec62634d0a8953ab3ba2ffce984a83.headers +++ b/test/fixtures/97ec62634d0a8953ab3ba2ffce984a83.headers @@ -1,22 +1,22 @@ { "statusCode": 200, "headers": { - "date": "Thu, 08 Dec 2016 22:10:47 GMT", + "date": "Thu, 08 Dec 2016 22:32:11 GMT", "content-type": "application/json; charset=utf-8", "transfer-encoding": "chunked", "connection": "keep-alive", "keep-alive": "timeout=15", "vary": "Accept-Encoding", "x-ratelimit-limit": "700", - "x-ratelimit-remaining": "297", - "x-ratelimit-reset": "1481235047", + "x-ratelimit-remaining": "254", + "x-ratelimit-reset": "1481236331", "server": "Plack::Handler::Starlet", - "etag": "W/\"40e494f99de2f93d29eb00587cf919e8\"", + "etag": "W/\"285b663debaf6f383194dcb82b6655e1\"", "access-control-allow-origin": "*", "content-encoding": "gzip" }, "url": "http://musicbrainz.org:80/ws/2/artist/ba550d0e-adac-4864-b88b-407cab5e76af?inc=artist-rels&fmt=json", - "time": 578, + "time": 677, "request": { "method": "GET", "headers": { diff --git a/test/fixtures/a81703ff2de3c55fdf82ff4d0a1f5052 b/test/fixtures/a81703ff2de3c55fdf82ff4d0a1f5052 index 14e944a..f887f94 100644 Binary files a/test/fixtures/a81703ff2de3c55fdf82ff4d0a1f5052 and b/test/fixtures/a81703ff2de3c55fdf82ff4d0a1f5052 differ diff --git a/test/fixtures/a81703ff2de3c55fdf82ff4d0a1f5052.headers b/test/fixtures/a81703ff2de3c55fdf82ff4d0a1f5052.headers index b94e736..e643e66 100644 --- a/test/fixtures/a81703ff2de3c55fdf82ff4d0a1f5052.headers +++ b/test/fixtures/a81703ff2de3c55fdf82ff4d0a1f5052.headers @@ -1,22 +1,22 @@ { "statusCode": 200, "headers": { - "date": "Thu, 08 Dec 2016 22:10:36 GMT", + "date": "Thu, 08 Dec 2016 22:32:01 GMT", "content-type": "application/json; charset=utf-8", "transfer-encoding": "chunked", "connection": "keep-alive", "keep-alive": "timeout=15", "vary": "Accept-Encoding", "x-ratelimit-limit": "700", - "x-ratelimit-remaining": "396", - "x-ratelimit-reset": "1481235037", + "x-ratelimit-remaining": "147", + "x-ratelimit-reset": "1481236321", "server": "Plack::Handler::Starlet", - "etag": "W/\"94bf3bba877af6290e53de6524fcbdf3\"", + "etag": "W/\"2dd0bb83c0e5e4f352ffbf3a1272050d\"", "access-control-allow-origin": "*", "content-encoding": "gzip" }, "url": "http://musicbrainz.org:80/ws/2/release-group?artist=c8da2e40-bd28-4d4e-813a-bd2f51958ba8&inc=artist-credits&fmt=json", - "time": 490, + "time": 439, "request": { "method": "GET", "headers": { diff --git a/test/fixtures/b1df6f5637b0de25ce9f54874c8ecffc b/test/fixtures/b1df6f5637b0de25ce9f54874c8ecffc index 316ad52..cc077d0 100644 Binary files a/test/fixtures/b1df6f5637b0de25ce9f54874c8ecffc and b/test/fixtures/b1df6f5637b0de25ce9f54874c8ecffc differ diff --git a/test/fixtures/b1df6f5637b0de25ce9f54874c8ecffc.headers b/test/fixtures/b1df6f5637b0de25ce9f54874c8ecffc.headers index ed9064b..28dae79 100644 --- a/test/fixtures/b1df6f5637b0de25ce9f54874c8ecffc.headers +++ b/test/fixtures/b1df6f5637b0de25ce9f54874c8ecffc.headers @@ -1,22 +1,22 @@ { "statusCode": 200, "headers": { - "date": "Thu, 08 Dec 2016 22:10:44 GMT", + "date": "Thu, 08 Dec 2016 22:32:10 GMT", "content-type": "application/json; charset=utf-8", "transfer-encoding": "chunked", "connection": "keep-alive", "keep-alive": "timeout=15", "vary": "Accept-Encoding", "x-ratelimit-limit": "700", - "x-ratelimit-remaining": "551", - "x-ratelimit-reset": "1481235045", + "x-ratelimit-remaining": "255", + "x-ratelimit-reset": "1481236331", "server": "Plack::Handler::Starlet", - "etag": "W/\"ff712330ac15db00e8bfb935e809bf95\"", + "etag": "W/\"dbec5286f8302667b6edff5be3352490\"", "access-control-allow-origin": "*", "content-encoding": "gzip" }, "url": "http://musicbrainz.org:80/ws/2/artist/49a51491-650e-44b3-8085-2f07ac2986dd?inc=artist-rels&fmt=json", - "time": 2134, + "time": 672, "request": { "method": "GET", "headers": { diff --git a/test/fixtures/c907a9892b9dacd1c8f6a85cf9b95fb9 b/test/fixtures/c907a9892b9dacd1c8f6a85cf9b95fb9 index 6cc2f4f..c8cd156 100644 Binary files a/test/fixtures/c907a9892b9dacd1c8f6a85cf9b95fb9 and b/test/fixtures/c907a9892b9dacd1c8f6a85cf9b95fb9 differ diff --git a/test/fixtures/c907a9892b9dacd1c8f6a85cf9b95fb9.headers b/test/fixtures/c907a9892b9dacd1c8f6a85cf9b95fb9.headers index 7b2cb4a..301576e 100644 --- a/test/fixtures/c907a9892b9dacd1c8f6a85cf9b95fb9.headers +++ b/test/fixtures/c907a9892b9dacd1c8f6a85cf9b95fb9.headers @@ -1,22 +1,22 @@ { "statusCode": 200, "headers": { - "date": "Thu, 08 Dec 2016 22:10:42 GMT", + "date": "Thu, 08 Dec 2016 22:32:06 GMT", "content-type": "application/json; charset=utf-8", "transfer-encoding": "chunked", "connection": "keep-alive", "keep-alive": "timeout=15", "vary": "Accept-Encoding", "x-ratelimit-limit": "700", - "x-ratelimit-remaining": "574", - "x-ratelimit-reset": "1481235043", + "x-ratelimit-remaining": "570", + "x-ratelimit-reset": "1481236327", "server": "Plack::Handler::Starlet", - "etag": "W/\"a60590c307227cfa6ee8fff91153f1bc\"", + "etag": "W/\"00e70096bc0434f732f47e3050094637\"", "access-control-allow-origin": "*", "content-encoding": "gzip" }, "url": "http://musicbrainz.org:80/ws/2/artist?release=2ac3cbf2-f0d0-3678-af5f-b62dcb051bc0&inc=artist-rels&fmt=json", - "time": 1544, + "time": 841, "request": { "method": "GET", "headers": { diff --git a/test/fixtures/d1a0073e6dcac919d8fdf8be12bfcbec b/test/fixtures/d1a0073e6dcac919d8fdf8be12bfcbec index 8c63d6f..cbb7c8a 100644 Binary files a/test/fixtures/d1a0073e6dcac919d8fdf8be12bfcbec and b/test/fixtures/d1a0073e6dcac919d8fdf8be12bfcbec differ diff --git a/test/fixtures/d1a0073e6dcac919d8fdf8be12bfcbec.headers b/test/fixtures/d1a0073e6dcac919d8fdf8be12bfcbec.headers index 5fefca3..4603681 100644 --- a/test/fixtures/d1a0073e6dcac919d8fdf8be12bfcbec.headers +++ b/test/fixtures/d1a0073e6dcac919d8fdf8be12bfcbec.headers @@ -1,22 +1,22 @@ { "statusCode": 200, "headers": { - "date": "Thu, 08 Dec 2016 22:10:47 GMT", + "date": "Thu, 08 Dec 2016 22:32:11 GMT", "content-type": "application/json; charset=utf-8", "transfer-encoding": "chunked", "connection": "keep-alive", "keep-alive": "timeout=15", "vary": "Accept-Encoding", "x-ratelimit-limit": "700", - "x-ratelimit-remaining": "299", - "x-ratelimit-reset": "1481235047", + "x-ratelimit-remaining": "253", + "x-ratelimit-reset": "1481236331", "server": "Plack::Handler::Starlet", - "etag": "W/\"fa1c3dc12994eab7fe0dcb44b627373c\"", + "etag": "W/\"262816d2e746629059388bf96eb1241d\"", "access-control-allow-origin": "*", "content-encoding": "gzip" }, "url": "http://musicbrainz.org:80/ws/2/artist/4d5447d7-c61c-4120-ba1b-d7f471d385b9?inc=artist-rels&fmt=json", - "time": 538, + "time": 676, "request": { "method": "GET", "headers": { diff --git a/test/fixtures/f2a7af3e3a39e31ee0d9d74b5820ebff b/test/fixtures/f2a7af3e3a39e31ee0d9d74b5820ebff index f30b97c..3c88946 100644 Binary files a/test/fixtures/f2a7af3e3a39e31ee0d9d74b5820ebff and b/test/fixtures/f2a7af3e3a39e31ee0d9d74b5820ebff differ diff --git a/test/fixtures/f2a7af3e3a39e31ee0d9d74b5820ebff.headers b/test/fixtures/f2a7af3e3a39e31ee0d9d74b5820ebff.headers index 5cfc8ba..b1dbbee 100644 --- a/test/fixtures/f2a7af3e3a39e31ee0d9d74b5820ebff.headers +++ b/test/fixtures/f2a7af3e3a39e31ee0d9d74b5820ebff.headers @@ -1,22 +1,22 @@ { "statusCode": 200, "headers": { - "date": "Thu, 08 Dec 2016 22:10:44 GMT", + "date": "Thu, 08 Dec 2016 22:32:06 GMT", "content-type": "application/json; charset=utf-8", "transfer-encoding": "chunked", "connection": "keep-alive", "keep-alive": "timeout=15", "vary": "Accept-Encoding", "x-ratelimit-limit": "700", - "x-ratelimit-remaining": "550", - "x-ratelimit-reset": "1481235045", + "x-ratelimit-remaining": "288", + "x-ratelimit-reset": "1481236327", "server": "Plack::Handler::Starlet", - "etag": "W/\"8816493f7872c79a0eabce9b71262302\"", + "etag": "W/\"7c937ac3dcff44777fa9d4c32d65b803\"", "access-control-allow-origin": "*", "content-encoding": "gzip" }, "url": "http://musicbrainz.org:80/ws/2/artist/42a8f507-8412-4611-854f-926571049fa0?inc=artist-rels&fmt=json", - "time": 2138, + "time": 558, "request": { "method": "GET", "headers": { diff --git a/test/schema.js b/test/schema.js index 2e6af39..faa3eac 100644 --- a/test/schema.js +++ b/test/schema.js @@ -12,6 +12,29 @@ const client = new MusicBrainz() const loaders = createLoaders(client) const context = { client, loaders } +test('schema has a node field', t => { + const query = ` + { + node(id: "UmVsZWFzZUdyb3VwOmUzN2QyNzQwLTQ1MDMtNGUzZi1hYjZkLWU2MjJhMjVlOTY0ZA==") { + __typename + ... on ReleaseGroup { + mbid + } + } + } + ` + return graphql(schema, query, null, context).then(result => { + t.deepEqual(result, { + data: { + node: { + __typename: 'ReleaseGroup', + mbid: 'e37d2740-4503-4e3f-ab6d-e622a25e964d' + } + } + }) + }) +}) + test('schema has a lookup query', t => { const query = ` {