graphql-document-collector
Advanced tools
Comparing version 0.2.1 to 0.2.2
@@ -31,2 +31,11 @@ "use strict"; | ||
}); | ||
it('should resolve all inline fragments', function () { | ||
return loader_1.loadGlob(path.join(__dirname, '..', '..', '..', 'inlineFragmentExample'), '**/*.graphql') | ||
.then(function (root) { | ||
var fMap = resolveFragments_1.createFragmentMap(root); | ||
var origDoc = root.directories[1].documents[0]; | ||
var transformedDoc = resolveFragments_1.addFragmentsToDocument(origDoc, fMap); | ||
chai_1.assert.equal(transformedDoc.definitions.length, 3); | ||
}); | ||
}); | ||
}); | ||
@@ -33,0 +42,0 @@ describe('resolveFragments', function () { |
@@ -25,2 +25,5 @@ "use strict"; | ||
} | ||
else if ((sel.kind === 'InlineFragment')) { | ||
fragmentSpreadsInSelectionSet(sel.selectionSet, fMap, fragmentSpreads); | ||
} | ||
}); | ||
@@ -27,0 +30,0 @@ return fragmentSpreads; |
{ | ||
"name": "graphql-document-collector", | ||
"version": "0.2.1", | ||
"version": "0.2.2", | ||
"description": "Load up smartly, in one location, all of the GraphQL queries/mutations/subscriptions of your project", | ||
@@ -5,0 +5,0 @@ "main": "lib", |
@@ -47,2 +47,15 @@ import {assert} from 'chai'; | ||
}); | ||
it('should resolve all inline fragments', () => { | ||
return loadGlob( | ||
path.join(__dirname, '..', '..', '..', 'inlineFragmentExample'), | ||
'**/*.graphql' | ||
) | ||
.then((root: DocumentDirectory) => { | ||
const fMap = createFragmentMap(root); | ||
const origDoc = root.directories[1].documents[0]; | ||
const transformedDoc = addFragmentsToDocument(origDoc, fMap); | ||
assert.equal(transformedDoc.definitions.length, 3); | ||
}); | ||
}); | ||
}); | ||
@@ -49,0 +62,0 @@ |
@@ -8,2 +8,3 @@ import { | ||
FieldNode, | ||
InlineFragmentNode, | ||
} from 'graphql'; | ||
@@ -41,2 +42,4 @@ import {DocumentDirectory} from '../ast'; | ||
fragmentSpreadsInSelectionSet((sel as FieldNode).selectionSet, fMap, fragmentSpreads); | ||
} else if ((sel.kind === 'InlineFragment')) { | ||
fragmentSpreadsInSelectionSet((sel as InlineFragmentNode).selectionSet, fMap, fragmentSpreads); | ||
} | ||
@@ -61,2 +64,3 @@ }); | ||
}); | ||
return Object.assign({}, document, { | ||
@@ -63,0 +67,0 @@ definitions: [ |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
75020
65
1407