Skip to content

Commit

Permalink
fix tests in Node 11 (#362)
Browse files Browse the repository at this point in the history
  • Loading branch information
rochdev authored Nov 8, 2018
1 parent 5bcba10 commit 38601db
Showing 1 changed file with 18 additions and 1 deletion.
19 changes: 18 additions & 1 deletion test/plugins/graphql.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,24 @@ describe('Plugin', () => {
describe('graphql', () => {
withVersions(plugin, 'graphql', version => {
before(() => {
sort = spans => spans.sort((a, b) => a.start.toString() >= b.start.toString() ? 1 : -1)
sort = spans => spans.sort((a, b) => {
const order = [
'graphql.query',
'graphql.mutation',
'graphql.subscription',
'graphql.parse',
'graphql.validate',
'graphql.execute',
'graphql.field',
'graphql.resolve'
]

if (a.start.toString() === b.start.toString()) {
return order.indexOf(a.name) - order.indexOf(b.name)
}

return a.start.toString() >= b.start.toString() ? 1 : -1
})
})

describe('without configuration', () => {
Expand Down

0 comments on commit 38601db

Please sign in to comment.