Skip to content

Commit

Permalink
Makesimpletransformschema
Browse files Browse the repository at this point in the history
  • Loading branch information
freiksenet committed Feb 15, 2018
1 parent 4e5c9b4 commit d9ae2df
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 14 deletions.
21 changes: 7 additions & 14 deletions src/test/testTransforms.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,14 +10,10 @@ import {
graphql,
} from 'graphql';
import { Request } from '../Interfaces';
import { Transform, applySchemaTransforms } from '../transforms/transforms';
import { Transform } from '../transforms/transforms';
import { visitSchema, VisitSchemaKind } from '../transforms/visitSchema';
import { propertySchema } from './testingSchemas';
import { addResolveFunctionsToSchema } from '../schemaGenerator';
import {
generateProxyingResolvers,
generateSimpleMapping,
} from '../stitching/resolvers';
import makeSimpleTransformSchema from '../transforms/makeSimpleTransformSchema';

function RenameTypes(renameMap: { [originalName: string]: string }): Transform {
const reverseMap = {};
Expand Down Expand Up @@ -68,6 +64,10 @@ function RenameTypes(renameMap: { [originalName: string]: string }): Transform {
// };
// }

// function importFromSchema(importString: string) {}
//
//

describe('transforms', () => {
describe('rename type', () => {
let schema: GraphQLSchema;
Expand All @@ -82,14 +82,7 @@ describe('transforms', () => {
TestInterfaceKind: 'TestingInterfaceKinds',
}),
];
schema = applySchemaTransforms(propertySchema, transforms);
const mapping = generateSimpleMapping(propertySchema);
const resolvers = generateProxyingResolvers(
propertySchema,
transforms,
mapping,
);
addResolveFunctionsToSchema(schema, resolvers);
schema = makeSimpleTransformSchema(propertySchema, transforms);
});
it('should work', async () => {
const result = await graphql(
Expand Down
2 changes: 2 additions & 0 deletions src/transforms/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,10 @@ import CheckResultAndHandleErrors from './CheckResultAndHandleErrors';
import ReplaceFieldWithFragment from './ReplaceFieldWithFragment';
import AddTypenameToAbstract from './AddTypenameToAbstract';
import FilterToSchema from './FilterToSchema';
import makeSimpleTransformSchema from './makeSimpleTransformSchema';
export * from './transforms';
export * from './visitSchema';
export { makeSimpleTransformSchema };
export const Transforms: { [name: string]: any } = {
AddArgumentsAsVariables,
CheckResultAndHandleErrors,
Expand Down

0 comments on commit d9ae2df

Please sign in to comment.