mirror of
https://github.com/BradNut/graphbrainz
synced 2025-09-08 17:40:32 +00:00
Use Duration scalar for recording lengths (#11)
This commit is contained in:
parent
c4c023c750
commit
0600c2026b
4 changed files with 43 additions and 3 deletions
|
|
@ -1,12 +1,11 @@
|
|||
import {
|
||||
GraphQLObjectType,
|
||||
GraphQLList,
|
||||
GraphQLInt,
|
||||
GraphQLBoolean
|
||||
} from 'graphql/type'
|
||||
import Node from './node'
|
||||
import Entity from './entity'
|
||||
import { ISRC } from './scalars'
|
||||
import { Duration, ISRC } from './scalars'
|
||||
import {
|
||||
id,
|
||||
mbid,
|
||||
|
|
@ -51,7 +50,7 @@ or mixing.`,
|
|||
(ISRCs) for this recording.`
|
||||
},
|
||||
length: {
|
||||
type: GraphQLInt,
|
||||
type: Duration,
|
||||
description: `An approximation to the length of the recording, calculated
|
||||
from the lengths of the tracks using it.`
|
||||
},
|
||||
|
|
|
|||
1
test/fixtures/81a6d797dbe67ce75ba99ed2f5315ee0
vendored
Normal file
1
test/fixtures/81a6d797dbe67ce75ba99ed2f5315ee0
vendored
Normal file
|
|
@ -0,0 +1 @@
|
|||
{"disambiguation":"","id":"9f9cf187-d6f9-437f-9d98-d59cdbd52757","video":false,"length":383493,"title":"Paranoid Android"}
|
||||
27
test/fixtures/81a6d797dbe67ce75ba99ed2f5315ee0.headers
vendored
Normal file
27
test/fixtures/81a6d797dbe67ce75ba99ed2f5315ee0.headers
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
{
|
||||
"statusCode": 200,
|
||||
"headers": {
|
||||
"date": "Sun, 11 Dec 2016 22:49:10 GMT",
|
||||
"content-type": "application/json; charset=utf-8",
|
||||
"content-length": "122",
|
||||
"connection": "keep-alive",
|
||||
"keep-alive": "timeout=15",
|
||||
"x-ratelimit-limit": "700",
|
||||
"x-ratelimit-remaining": "535",
|
||||
"x-ratelimit-reset": "1481496552",
|
||||
"server": "Plack::Handler::Starlet",
|
||||
"etag": "\"6a43a7029600ae595783f39d6d3d1f63\"",
|
||||
"access-control-allow-origin": "*"
|
||||
},
|
||||
"url": "http://musicbrainz.org:80/ws/2/recording/9f9cf187-d6f9-437f-9d98-d59cdbd52757?fmt=json",
|
||||
"time": 424,
|
||||
"request": {
|
||||
"method": "GET",
|
||||
"headers": {
|
||||
"User-Agent": "graphbrainz/4.2.0 ( https://github.com/exogen/graphbrainz )",
|
||||
"host": "musicbrainz.org",
|
||||
"accept-encoding": "gzip, deflate",
|
||||
"accept": "application/json"
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
@ -579,3 +579,16 @@ test('Works can be browsed by iswc', testData, `
|
|||
{ title: 'Song of the French Partisan', iswcs: ['T-900.755.682-3'] }
|
||||
])
|
||||
})
|
||||
|
||||
test('Recordings have a length in milliseconds', testData, `
|
||||
{
|
||||
lookup {
|
||||
recording(mbid: "9f9cf187-d6f9-437f-9d98-d59cdbd52757") {
|
||||
length
|
||||
}
|
||||
}
|
||||
}
|
||||
`, (t, data) => {
|
||||
const { recording } = data.lookup
|
||||
t.is(recording.length, 383493)
|
||||
})
|
||||
|
|
|
|||
Loading…
Reference in a new issue