mirror of
https://github.com/BradNut/graphbrainz
synced 2025-09-08 17:40:32 +00:00
Bump deps and fix rating type (#38)
* Bump deps and fix rating type * Add a new test macro, testThrows, due to GraphQL bug
This commit is contained in:
parent
35db26f8ce
commit
698ba58492
7 changed files with 1301 additions and 1219 deletions
|
|
@ -1239,7 +1239,7 @@ type Rating {
|
||||||
voteCount: Int!
|
voteCount: Int!
|
||||||
|
|
||||||
# The average rating value based on the aggregated votes.
|
# The average rating value based on the aggregated votes.
|
||||||
value: Int
|
value: Float
|
||||||
}
|
}
|
||||||
|
|
||||||
# A [recording](https://musicbrainz.org/doc/Recording) is an
|
# A [recording](https://musicbrainz.org/doc/Recording) is an
|
||||||
|
|
|
||||||
|
|
@ -78,6 +78,7 @@ You may also be interested in reading the [schema in GraphQL syntax](schema.md).
|
||||||
* [Degrees](#degrees)
|
* [Degrees](#degrees)
|
||||||
* [DiscID](#discid)
|
* [DiscID](#discid)
|
||||||
* [Duration](#duration)
|
* [Duration](#duration)
|
||||||
|
* [Float](#float)
|
||||||
* [ID](#id)
|
* [ID](#id)
|
||||||
* [IPI](#ipi)
|
* [IPI](#ipi)
|
||||||
* [ISNI](#isni)
|
* [ISNI](#isni)
|
||||||
|
|
@ -3957,7 +3958,7 @@ The number of votes that have contributed to the rating.
|
||||||
</tr>
|
</tr>
|
||||||
<tr>
|
<tr>
|
||||||
<td colspan="2" valign="top"><strong>value</strong></td>
|
<td colspan="2" valign="top"><strong>value</strong></td>
|
||||||
<td valign="top"><a href="#int">Int</a></td>
|
<td valign="top"><a href="#float">Float</a></td>
|
||||||
<td>
|
<td>
|
||||||
|
|
||||||
The average rating value based on the aggregated votes.
|
The average rating value based on the aggregated votes.
|
||||||
|
|
@ -7535,6 +7536,10 @@ offsets and hence the same disc ID.
|
||||||
|
|
||||||
A length of time, in milliseconds.
|
A length of time, in milliseconds.
|
||||||
|
|
||||||
|
### Float
|
||||||
|
|
||||||
|
The `Float` scalar type represents signed double-precision fractional values as specified by [IEEE 754](http://en.wikipedia.org/wiki/IEEE_floating_point).
|
||||||
|
|
||||||
### ID
|
### ID
|
||||||
|
|
||||||
The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `"4"`) or integer (such as `4`) input value will be accepted as an ID.
|
The `ID` scalar type represents a unique identifier, often used to refetch an object or as key for a cache. The ID type appears in a JSON response as a String; however, it is not intended to be human-readable. When expected as an input type, any string (such as `"4"`) or integer (such as `4`) input value will be accepted as an ID.
|
||||||
|
|
|
||||||
38
package.json
38
package.json
|
|
@ -66,44 +66,44 @@
|
||||||
},
|
},
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"babel-runtime": "^6.23.0",
|
"babel-runtime": "^6.25.0",
|
||||||
"compression": "^1.6.2",
|
"compression": "^1.7.0",
|
||||||
"dashify": "^0.2.2",
|
"dashify": "^0.2.2",
|
||||||
"dataloader": "^1.3.0",
|
"dataloader": "^1.3.0",
|
||||||
"debug": "^2.6.6",
|
"debug": "^3.0.0",
|
||||||
"dotenv": "^4.0.0",
|
"dotenv": "^4.0.0",
|
||||||
"es6-error": "^4.0.2",
|
"es6-error": "^4.0.2",
|
||||||
"express": "^4.15.2",
|
"express": "^4.15.4",
|
||||||
"express-graphql": "^0.6.4",
|
"express-graphql": "^0.6.7",
|
||||||
"graphql": "^0.9.4",
|
"graphql": "^0.11.7",
|
||||||
"graphql-relay": "^0.5.1",
|
"graphql-relay": "^0.5.2",
|
||||||
"lru-cache": "^4.0.1",
|
"lru-cache": "^4.1.1",
|
||||||
"pascalcase": "^0.1.1",
|
"pascalcase": "^0.1.1",
|
||||||
"postinstall-build": "^5.0.0",
|
"postinstall-build": "^5.0.1",
|
||||||
"qs": "^6.4.0",
|
"qs": "^6.5.0",
|
||||||
"request": "^2.81.0",
|
"request": "^2.81.0",
|
||||||
"retry": "^0.10.1"
|
"retry": "^0.10.1"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
"ava": "^0.19.1",
|
"ava": "^0.22.0",
|
||||||
"babel-cli": "^6.24.1",
|
"babel-cli": "^6.24.1",
|
||||||
"babel-eslint": "^7.2.3",
|
"babel-eslint": "^8.0.1",
|
||||||
"babel-plugin-istanbul": "^4.1.1",
|
"babel-plugin-istanbul": "^4.1.4",
|
||||||
"babel-plugin-transform-runtime": "^6.23.0",
|
"babel-plugin-transform-runtime": "^6.23.0",
|
||||||
"babel-preset-es2015": "^6.24.1",
|
"babel-preset-es2015": "^6.24.1",
|
||||||
"babel-preset-stage-2": "^6.24.1",
|
"babel-preset-stage-2": "^6.24.1",
|
||||||
"babel-register": "^6.24.1",
|
"babel-register": "^6.24.1",
|
||||||
"coveralls": "^2.13.1",
|
"coveralls": "^3.0.0",
|
||||||
"cross-env": "^4.0.0",
|
"cross-env": "^5.0.5",
|
||||||
"doctoc": "^1.3.0",
|
"doctoc": "^1.3.0",
|
||||||
"graphql-markdown": "^2.1.0",
|
"graphql-markdown": "^2.2.0",
|
||||||
"nodemon": "^1.11.0",
|
"nodemon": "^1.11.0",
|
||||||
"nyc": "^10.2.0",
|
"nyc": "^11.1.0",
|
||||||
"rimraf": "^2.6.1",
|
"rimraf": "^2.6.1",
|
||||||
"sepia": "^2.0.2",
|
"sepia": "^2.0.2",
|
||||||
"sinon": "^2.1.0",
|
"sinon": "^4.0.1",
|
||||||
"snazzy": "^7.0.0",
|
"snazzy": "^7.0.0",
|
||||||
"standard": "^10.0.2"
|
"standard": "^10.0.3"
|
||||||
},
|
},
|
||||||
"standard": {
|
"standard": {
|
||||||
"parser": "babel-eslint"
|
"parser": "babel-eslint"
|
||||||
|
|
|
||||||
12
schema.json
12
schema.json
|
|
@ -6722,7 +6722,7 @@
|
||||||
"args": [],
|
"args": [],
|
||||||
"type": {
|
"type": {
|
||||||
"kind": "SCALAR",
|
"kind": "SCALAR",
|
||||||
"name": "Int",
|
"name": "Float",
|
||||||
"ofType": null
|
"ofType": null
|
||||||
},
|
},
|
||||||
"isDeprecated": false,
|
"isDeprecated": false,
|
||||||
|
|
@ -6734,6 +6734,16 @@
|
||||||
"enumValues": null,
|
"enumValues": null,
|
||||||
"possibleTypes": null
|
"possibleTypes": null
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"kind": "SCALAR",
|
||||||
|
"name": "Float",
|
||||||
|
"description": "The `Float` scalar type represents signed double-precision fractional values as specified by [IEEE 754](http://en.wikipedia.org/wiki/IEEE_floating_point). ",
|
||||||
|
"fields": null,
|
||||||
|
"inputFields": null,
|
||||||
|
"interfaces": null,
|
||||||
|
"enumValues": null,
|
||||||
|
"possibleTypes": null
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"kind": "OBJECT",
|
"kind": "OBJECT",
|
||||||
"name": "TagConnection",
|
"name": "TagConnection",
|
||||||
|
|
|
||||||
|
|
@ -1,7 +1,8 @@
|
||||||
import {
|
import {
|
||||||
GraphQLObjectType,
|
GraphQLObjectType,
|
||||||
GraphQLNonNull,
|
GraphQLNonNull,
|
||||||
GraphQLInt
|
GraphQLInt,
|
||||||
|
GraphQLFloat
|
||||||
} from 'graphql/type'
|
} from 'graphql/type'
|
||||||
|
|
||||||
export default new GraphQLObjectType({
|
export default new GraphQLObjectType({
|
||||||
|
|
@ -17,7 +18,7 @@ for the entity.`,
|
||||||
resolve: rating => rating['votes-count']
|
resolve: rating => rating['votes-count']
|
||||||
},
|
},
|
||||||
value: {
|
value: {
|
||||||
type: GraphQLInt,
|
type: GraphQLFloat,
|
||||||
description: 'The average rating value based on the aggregated votes.'
|
description: 'The average rating value based on the aggregated votes.'
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
|
||||||
|
|
@ -5,6 +5,9 @@ import context from './helpers/context'
|
||||||
|
|
||||||
function testData (t, query, handler) {
|
function testData (t, query, handler) {
|
||||||
return graphql(schema, query, null, context).then(result => {
|
return graphql(schema, query, null, context).then(result => {
|
||||||
|
if (result.errors !== undefined) {
|
||||||
|
console.log(result.errors)
|
||||||
|
}
|
||||||
t.is(result.errors, undefined)
|
t.is(result.errors, undefined)
|
||||||
return handler(t, result.data)
|
return handler(t, result.data)
|
||||||
})
|
})
|
||||||
|
|
@ -18,6 +21,11 @@ function testError (t, query, handler) {
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function testThrows (t, query, handler) {
|
||||||
|
const error = t.throws(graphql(schema, query, null, context))
|
||||||
|
return handler(t, error)
|
||||||
|
}
|
||||||
|
|
||||||
test('schema has a node field', testData, `
|
test('schema has a node field', testData, `
|
||||||
{
|
{
|
||||||
node(id: "UmVsZWFzZUdyb3VwOmUzN2QyNzQwLTQ1MDMtNGUzZi1hYjZkLWU2MjJhMjVlOTY0ZA==") {
|
node(id: "UmVsZWFzZUdyb3VwOmUzN2QyNzQwLTQ1MDMtNGUzZi1hYjZkLWU2MjJhMjVlOTY0ZA==") {
|
||||||
|
|
@ -182,7 +190,8 @@ test('supports deeply nested queries', testData, `
|
||||||
t.is(labels.edges[0].node.releases.edges.length, 1)
|
t.is(labels.edges[0].node.releases.edges.length, 1)
|
||||||
})
|
})
|
||||||
|
|
||||||
test('throws an error if given a malformed MBID', testError, `
|
// FIXME: https://github.com/graphql/graphql-js/issues/910
|
||||||
|
test('throws an error if given a malformed MBID', testThrows, `
|
||||||
{
|
{
|
||||||
lookup {
|
lookup {
|
||||||
artist(mbid: "ABC123") {
|
artist(mbid: "ABC123") {
|
||||||
|
|
@ -190,8 +199,8 @@ test('throws an error if given a malformed MBID', testError, `
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`, (t, errors) => {
|
`, async (t, promise) => {
|
||||||
const err = errors[0]
|
const err = await promise
|
||||||
t.true(err instanceof TypeError)
|
t.true(err instanceof TypeError)
|
||||||
t.is(err.message, 'Malformed MBID: ABC123')
|
t.is(err.message, 'Malformed MBID: ABC123')
|
||||||
})
|
})
|
||||||
|
|
@ -476,7 +485,8 @@ test('URLs may be looked up by resource', testData, `
|
||||||
t.is(url.resource, 'http://www.nirvana.com/')
|
t.is(url.resource, 'http://www.nirvana.com/')
|
||||||
})
|
})
|
||||||
|
|
||||||
test('throws an error if given a malformed resource URL', testError, `
|
// FIXME: https://github.com/graphql/graphql-js/issues/910
|
||||||
|
test('throws an error if given a malformed resource URL', testThrows, `
|
||||||
{
|
{
|
||||||
lookup {
|
lookup {
|
||||||
url(resource: "http:foo") {
|
url(resource: "http:foo") {
|
||||||
|
|
@ -485,8 +495,8 @@ test('throws an error if given a malformed resource URL', testError, `
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
`, (t, errors) => {
|
`, async (t, promise) => {
|
||||||
const err = errors[0]
|
const err = await promise
|
||||||
t.true(err instanceof TypeError)
|
t.true(err instanceof TypeError)
|
||||||
t.is(err.message, 'Malformed URL: http:foo')
|
t.is(err.message, 'Malformed URL: http:foo')
|
||||||
})
|
})
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue