Reconsider test indentation

This commit is contained in:
Brian Beck 2016-12-11 12:37:25 -08:00
parent b2ec20ed2c
commit 195e9fdb7c

View file

@ -18,8 +18,7 @@ function testError (t, query, handler) {
}) })
} }
test('schema has a node field', testData, test('schema has a node field', testData, `
`
{ {
node(id: "UmVsZWFzZUdyb3VwOmUzN2QyNzQwLTQ1MDMtNGUzZi1hYjZkLWU2MjJhMjVlOTY0ZA==") { node(id: "UmVsZWFzZUdyb3VwOmUzN2QyNzQwLTQ1MDMtNGUzZi1hYjZkLWU2MjJhMjVlOTY0ZA==") {
__typename __typename
@ -35,11 +34,9 @@ test('schema has a node field', testData,
mbid: 'e37d2740-4503-4e3f-ab6d-e622a25e964d' mbid: 'e37d2740-4503-4e3f-ab6d-e622a25e964d'
} }
}) })
} })
)
test('schema has a lookup query', testData, test('schema has a lookup query', testData, `
`
{ {
lookup { lookup {
artist (mbid: "c8da2e40-bd28-4d4e-813a-bd2f51958ba8") { artist (mbid: "c8da2e40-bd28-4d4e-813a-bd2f51958ba8") {
@ -61,8 +58,7 @@ test('schema has a lookup query', testData,
}) })
}) })
test('schema has a search query', testData, test('schema has a search query', testData, `
`
{ {
search { search {
recordings (query: "Burn the Witch") { recordings (query: "Burn the Witch") {
@ -84,8 +80,7 @@ test('schema has a search query', testData,
recordings.edges.forEach(edge => t.true(edge.score > 0)) recordings.edges.forEach(edge => t.true(edge.score > 0))
}) })
test('schema has a browse query', testData, test('schema has a browse query', testData, `
`
{ {
browse { browse {
releaseGroups (artist: "c8da2e40-bd28-4d4e-813a-bd2f51958ba8") { releaseGroups (artist: "c8da2e40-bd28-4d4e-813a-bd2f51958ba8") {
@ -113,8 +108,7 @@ test('schema has a browse query', testData,
releaseGroups.edges.forEach(edge => t.truthy(edge.node.title)) releaseGroups.edges.forEach(edge => t.truthy(edge.node.title))
}) })
test('supports deeply nested queries', testData, test('supports deeply nested queries', testData, `
`
query AppleRecordsMarriages { query AppleRecordsMarriages {
search { search {
labels(query: "Apple Records", first: 1) { labels(query: "Apple Records", first: 1) {
@ -188,8 +182,7 @@ 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, test('throws an error if given a malformed MBID', testError, `
`
{ {
lookup { lookup {
artist(mbid: "ABC123") { artist(mbid: "ABC123") {
@ -203,8 +196,7 @@ test('throws an error if given a malformed MBID', testError,
t.is(err.message, 'Malformed MBID: ABC123') t.is(err.message, 'Malformed MBID: ABC123')
}) })
test('Artist beginArea/endArea pulls from begin_area/end_area for lookup queries', testData, test('Artist beginArea/endArea pulls from begin_area/end_area for lookup queries', testData, `
`
{ {
lookup { lookup {
artist(mbid: "65314b12-0e08-43fa-ba33-baaa7b874c15") { artist(mbid: "65314b12-0e08-43fa-ba33-baaa7b874c15") {
@ -223,8 +215,7 @@ test('Artist beginArea/endArea pulls from begin_area/end_area for lookup queries
t.is(artist.endArea.name, 'Los Angeles') t.is(artist.endArea.name, 'Los Angeles')
}) })
test('Artist beginArea/endArea pull from begin_area/end_area for browse queries', testData, test('Artist beginArea/endArea pull from begin_area/end_area for browse queries', testData, `
`
{ {
browse { browse {
artists(area: "3f504d54-c40c-487d-bc16-c1990eac887f") { artists(area: "3f504d54-c40c-487d-bc16-c1990eac887f") {
@ -248,8 +239,7 @@ test('Artist beginArea/endArea pull from begin_area/end_area for browse queries'
t.true(artists.some(artist => artist.endArea)) t.true(artists.some(artist => artist.endArea))
}) })
test('Artist beginArea/endArea pulls from begin-area/end-area for search queries', testData, test('Artist beginArea/endArea pulls from begin-area/end-area for search queries', testData, `
`
{ {
search { search {
artists(query: "Leonard Cohen", first: 1) { artists(query: "Leonard Cohen", first: 1) {
@ -273,8 +263,7 @@ test('Artist beginArea/endArea pulls from begin-area/end-area for search queries
t.is(artists[0].endArea.name, 'Los Angeles') t.is(artists[0].endArea.name, 'Los Angeles')
}) })
test('relationships filter by type', testData, test('relationships filter by type', testData, `
`
{ {
lookup { lookup {
artist(mbid: "65314b12-0e08-43fa-ba33-baaa7b874c15") { artist(mbid: "65314b12-0e08-43fa-ba33-baaa7b874c15") {
@ -332,8 +321,7 @@ test('relationships filter by type', testData,
}) })
}) })
test('Area maps iso-3166-1-codes to isoCodes', testData, test('Area maps iso-3166-1-codes to isoCodes', testData, `
`
{ {
lookup { lookup {
area(mbid: "489ce91b-6658-3307-9877-795b68554c98") { area(mbid: "489ce91b-6658-3307-9877-795b68554c98") {
@ -346,8 +334,7 @@ test('Area maps iso-3166-1-codes to isoCodes', testData,
t.deepEqual(data.lookup.area.isoCodes, ['US']) t.deepEqual(data.lookup.area.isoCodes, ['US'])
}) })
test('Alias locales use the Locale scalar', testData, test('Alias locales use the Locale scalar', testData, `
`
{ {
lookup { lookup {
artist(mbid: "f99b7d67-4e63-4678-aa66-4c6ac0f7d24a") { artist(mbid: "f99b7d67-4e63-4678-aa66-4c6ac0f7d24a") {
@ -364,8 +351,7 @@ test('Alias locales use the Locale scalar', testData,
t.is(aliases.find(alias => alias.locale === 'ko').name, '싸이') t.is(aliases.find(alias => alias.locale === 'ko').name, '싸이')
}) })
test('Work ISWCs use the ISWC scalar', testData, test('Work ISWCs use the ISWC scalar', testData, `
`
{ {
lookup { lookup {
work(mbid: "ef7d0814-da6a-32f5-a600-ff81cffd1aed") { work(mbid: "ef7d0814-da6a-32f5-a600-ff81cffd1aed") {
@ -380,8 +366,7 @@ test('Work ISWCs use the ISWC scalar', testData,
t.deepEqual(work.iswcs, ['T-900.755.682-3']) t.deepEqual(work.iswcs, ['T-900.755.682-3'])
}) })
test('URLs may be looked up by resource', testData, test('URLs may be looked up by resource', testData, `
`
{ {
lookup { lookup {
url(resource: "http://www.nirvana.com/") { url(resource: "http://www.nirvana.com/") {
@ -396,8 +381,7 @@ 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 URLString', testError, test('throws an error if given a malformed URLString', testError, `
`
{ {
lookup { lookup {
url(resource: "http:foo") { url(resource: "http:foo") {
@ -412,8 +396,7 @@ test('throws an error if given a malformed URLString', testError,
t.is(err.message, 'Malformed URL: http:foo') t.is(err.message, 'Malformed URL: http:foo')
}) })
test('Release groups can be browsed by type', testData, test('Release groups can be browsed by type', testData, `
`
{ {
browse { browse {
releaseGroups(artist: "5b11f4ce-a62d-471e-81fc-a69a8278c7da", type: EP) { releaseGroups(artist: "5b11f4ce-a62d-471e-81fc-a69a8278c7da", type: EP) {
@ -431,8 +414,7 @@ test('Release groups can be browsed by type', testData,
releaseGroups.forEach(releaseGroup => t.is(releaseGroup.primaryType, 'EP')) releaseGroups.forEach(releaseGroup => t.is(releaseGroup.primaryType, 'EP'))
}) })
test('Releases can be browsed by type and status', testData, test('Releases can be browsed by type and status', testData, `
`
{ {
browse { browse {
releases(artist: "5b11f4ce-a62d-471e-81fc-a69a8278c7da", type: EP, status: BOOTLEG) { releases(artist: "5b11f4ce-a62d-471e-81fc-a69a8278c7da", type: EP, status: BOOTLEG) {
@ -450,8 +432,7 @@ test('Releases can be browsed by type and status', testData,
releases.forEach(release => t.is(release.status, 'BOOTLEG')) releases.forEach(release => t.is(release.status, 'BOOTLEG'))
}) })
test('Releases have an ASIN field', testData, test('Releases have an ASIN field', testData, `
`
{ {
lookup { lookup {
release(mbid: "d5cdb7fd-c7e9-460a-9549-8a369655cc52") { release(mbid: "d5cdb7fd-c7e9-460a-9549-8a369655cc52") {
@ -464,8 +445,7 @@ test('Releases have an ASIN field', testData,
t.is(release.asin, 'B01KN6XDS6') t.is(release.asin, 'B01KN6XDS6')
}) })
test('Artists have a list of ISNIs and IPIs', testData, test('Artists have a list of ISNIs and IPIs', testData, `
`
{ {
lookup { lookup {
artist(mbid: "65314b12-0e08-43fa-ba33-baaa7b874c15") { artist(mbid: "65314b12-0e08-43fa-ba33-baaa7b874c15") {
@ -480,8 +460,7 @@ test('Artists have a list of ISNIs and IPIs', testData,
t.deepEqual(artist.isnis, ['0000000110273481']) t.deepEqual(artist.isnis, ['0000000110273481'])
}) })
test('artistCredits is an alias for artistCredit', testData, test('artistCredits is an alias for artistCredit', testData, `
`
{ {
lookup { lookup {
recording(mbid: "07649758-09c8-4d70-bc6f-5c37ab36334d") { recording(mbid: "07649758-09c8-4d70-bc6f-5c37ab36334d") {