Skip to content

Commit

Permalink
Fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
ardatan committed Dec 14, 2024
1 parent fb59ac6 commit e305f9b
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
24 changes: 12 additions & 12 deletions packages/plugins/typescript/react-apollo/tests/react-apollo.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2705,7 +2705,7 @@ export function useListenToCommentsSubscription(baseOptions?: Apollo.Subscriptio
outputFile: 'graphql.tsx',
})) as Types.ComplexPluginOutput;

expect(content.prepend).toContain(`import * as Operations from './document.graphql.js';`);
expect(content.prepend).toContain(`import * as Operations from './document.graphql';`);
expect(content.content).toBeSimilarStringTo(`
export const TestComponent = (props: TestComponentProps) => (
<ApolloReactComponents.Query<TestQuery, TestQueryVariables> query={Operations.test} {...props} />
Expand All @@ -2728,7 +2728,7 @@ export function useListenToCommentsSubscription(baseOptions?: Apollo.Subscriptio
outputFile: 'graphql.tsx',
})) as Types.ComplexPluginOutput;

expect(content.prepend).toContain(`import * as Operations from './document.graphql.js';`);
expect(content.prepend).toContain(`import * as Operations from './document.graphql';`);
expect(content.content).toBeSimilarStringTo(`
export function useTestQuery(baseOptions?: Apollo.QueryHookOptions<TestQuery, TestQueryVariables>) {
const options = {...defaultOptions, ...baseOptions}
Expand Down Expand Up @@ -2765,7 +2765,7 @@ export function useListenToCommentsSubscription(baseOptions?: Apollo.Subscriptio
outputFile: 'graphql.tsx',
})) as Types.ComplexPluginOutput;

expect(content.prepend).toContain(`import * as Operations from './document.graphql.js';`);
expect(content.prepend).toContain(`import * as Operations from './document.graphql';`);
expect(content.content).toBeSimilarStringTo(`
export function withTest<TProps, TChildProps = {}, TDataName extends string = 'data'>(operationOptions?: ApolloReactHoc.OperationOption<
TProps,
Expand Down Expand Up @@ -2796,7 +2796,7 @@ export function useListenToCommentsSubscription(baseOptions?: Apollo.Subscriptio
outputFile: 'graphql.tsx',
})) as Types.ComplexPluginOutput;

expect(content.prepend).toContain(`import * as Operations from './document.graphql.js';`);
expect(content.prepend).toContain(`import * as Operations from './document.graphql';`);
expect(content.content).toBeSimilarStringTo(`
export const TestComponent = (props: TestComponentProps) => (
<ApolloReactComponents.Mutation<TestMutation, TestMutationVariables> mutation={Operations.test} {...props} />
Expand Down Expand Up @@ -2853,7 +2853,7 @@ export function useListenToCommentsSubscription(baseOptions?: Apollo.Subscriptio
outputFile: 'graphql.tsx',
})) as Types.ComplexPluginOutput;

expect(content.prepend).toContain(`import * as Operations from './document.graphql.js';`);
expect(content.prepend).toContain(`import * as Operations from './document.graphql';`);
expect(content.content).toBeSimilarStringTo(`
export function useTestMutation(baseOptions?: Apollo.MutationHookOptions<TestMutation, TestMutationVariables>) {
const options = {...defaultOptions, ...baseOptions}
Expand All @@ -2877,7 +2877,7 @@ export function useListenToCommentsSubscription(baseOptions?: Apollo.Subscriptio
outputFile: 'graphql.tsx',
})) as Types.ComplexPluginOutput;

expect(content.prepend).toContain(`import * as Operations from './document.graphql.js';`);
expect(content.prepend).toContain(`import * as Operations from './document.graphql';`);
expect(content.content).toBeSimilarStringTo(`
export function withTest<TProps, TChildProps = {}, TDataName extends string = 'mutate'>(operationOptions?: ApolloReactHoc.OperationOption<
TProps,
Expand Down Expand Up @@ -2908,7 +2908,7 @@ export function useListenToCommentsSubscription(baseOptions?: Apollo.Subscriptio
outputFile: 'graphql.tsx',
})) as Types.ComplexPluginOutput;

expect(content.prepend).toContain(`import * as Operations from './document.graphql.js';`);
expect(content.prepend).toContain(`import * as Operations from './document.graphql';`);
expect(content.content).toBeSimilarStringTo(`
export const TestComponent = (props: TestComponentProps) => (
<ApolloReactComponents.Subscription<TestSubscription, TestSubscriptionVariables> subscription={Operations.test} {...props} />
Expand All @@ -2931,7 +2931,7 @@ export function useListenToCommentsSubscription(baseOptions?: Apollo.Subscriptio
outputFile: 'graphql.tsx',
})) as Types.ComplexPluginOutput;

expect(content.prepend).toContain(`import * as Operations from './document.graphql.js';`);
expect(content.prepend).toContain(`import * as Operations from './document.graphql';`);
expect(content.content).toBeSimilarStringTo(`
export function useTestSubscription(baseOptions?: Apollo.SubscriptionHookOptions<TestSubscription, TestSubscriptionVariables>) {
const options = {...defaultOptions, ...baseOptions}
Expand All @@ -2955,7 +2955,7 @@ export function useListenToCommentsSubscription(baseOptions?: Apollo.Subscriptio
outputFile: 'graphql.tsx',
})) as Types.ComplexPluginOutput;

expect(content.prepend).toContain(`import * as Operations from './document.graphql.js';`);
expect(content.prepend).toContain(`import * as Operations from './document.graphql';`);
expect(content.content).toBeSimilarStringTo(`
export function withTest<TProps, TChildProps = {}, TDataName extends string = 'data'>(operationOptions?: ApolloReactHoc.OperationOption<
TProps,
Expand Down Expand Up @@ -2986,7 +2986,7 @@ export function useListenToCommentsSubscription(baseOptions?: Apollo.Subscriptio
outputFile: 'graphql.tsx',
})) as Types.ComplexPluginOutput;

expect(content.prepend).toContain(`import * as Operations from './document.graphql.js';`);
expect(content.prepend).toContain(`import * as Operations from './document.graphql';`);
expect(content.content).toBeSimilarStringTo(`
export const TestOneComponent = (props: TestOneComponentProps) => (
<ApolloReactComponents.Query<TestOneQuery, TestOneQueryVariables> query={Operations.testOne} {...props} />
Expand Down Expand Up @@ -3018,7 +3018,7 @@ export function useListenToCommentsSubscription(baseOptions?: Apollo.Subscriptio
outputFile: 'graphql.tsx',
})) as Types.ComplexPluginOutput;

expect(content.prepend).toContain(`import * as Operations from './document.graphql.js';`);
expect(content.prepend).toContain(`import * as Operations from './document.graphql';`);
expect(content.content).toBeSimilarStringTo(`
export function useTestOneQuery(baseOptions?: Apollo.QueryHookOptions<TestOneQuery, TestOneQueryVariables>) {
const options = {...defaultOptions, ...baseOptions}
Expand Down Expand Up @@ -3067,7 +3067,7 @@ export function useListenToCommentsSubscription(baseOptions?: Apollo.Subscriptio
outputFile: 'graphql.tsx',
})) as Types.ComplexPluginOutput;

expect(content.prepend).toContain(`import * as Operations from './document.graphql.js';`);
expect(content.prepend).toContain(`import * as Operations from './document.graphql';`);
expect(content.content).toBeSimilarStringTo(`
export function withTestOne<TProps, TChildProps = {}, TDataName extends string = 'data'>(operationOptions?: ApolloReactHoc.OperationOption<
TProps,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1281,7 +1281,7 @@ query MyFeed {
outputFile: 'graphql.ts',
})) as Types.ComplexPluginOutput;

expect(content.prepend).toContain(`import * as Operations from './document.graphql.js';`);
expect(content.prepend).toContain(`import * as Operations from './document.graphql';`);
expect(content.content).toBeSimilarStringTo(`export const useTestQuery`);
await validateTypeScript(content, schema, docs, {});
});
Expand All @@ -1298,7 +1298,7 @@ query MyFeed {
outputFile: 'graphql.ts',
})) as Types.ComplexPluginOutput;

expect(content.prepend).toContain(`import * as Operations from './document.graphql.js';`);
expect(content.prepend).toContain(`import * as Operations from './document.graphql';`);
expect(content.content).toBeSimilarStringTo(`export const testMutation`);
await validateTypeScript(content, schema, docs, {});
});
Expand All @@ -1315,7 +1315,7 @@ query MyFeed {
outputFile: 'graphql.ts',
})) as Types.ComplexPluginOutput;

expect(content.prepend).toContain(`import * as Operations from './document.graphql.js';`);
expect(content.prepend).toContain(`import * as Operations from './document.graphql';`);
expect(content.content).toBeSimilarStringTo(`export const useTestSubscription`);
await validateTypeScript(content, schema, docs, {});
});
Expand All @@ -1332,7 +1332,7 @@ query MyFeed {
outputFile: 'graphql.ts',
})) as Types.ComplexPluginOutput;

expect(content.prepend).toContain(`import * as Operations from './document.graphql.js';`);
expect(content.prepend).toContain(`import * as Operations from './document.graphql';`);
expect(content.content).toBeSimilarStringTo(`export const useTestOneQuery`);
expect(content.content).toBeSimilarStringTo(`export const testTwoMutation`);
expect(content.content).toBeSimilarStringTo(`export const useTestThreeSubscription`);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1341,7 +1341,7 @@ query MyFeed {
outputFile: 'graphql.ts',
})) as Types.ComplexPluginOutput;

expect(content.prepend).toContain(`import * as Operations from './document.graphql.js';`);
expect(content.prepend).toContain(`import * as Operations from './document.graphql';`);
expect(content.content).toBeSimilarStringTo(`export function useTestQuery`);
await validateTypeScript(content, schema, docs, {});
});
Expand All @@ -1358,7 +1358,7 @@ query MyFeed {
outputFile: 'graphql.ts',
})) as Types.ComplexPluginOutput;

expect(content.prepend).toContain(`import * as Operations from './document.graphql.js';`);
expect(content.prepend).toContain(`import * as Operations from './document.graphql';`);
expect(content.content).toBeSimilarStringTo(`export function useTestMutation`);
await validateTypeScript(content, schema, docs, {});
});
Expand All @@ -1375,7 +1375,7 @@ query MyFeed {
outputFile: 'graphql.ts',
})) as Types.ComplexPluginOutput;

expect(content.prepend).toContain(`import * as Operations from './document.graphql.js';`);
expect(content.prepend).toContain(`import * as Operations from './document.graphql';`);
expect(content.content).toBeSimilarStringTo(`export function useTestSubscription`);
await validateTypeScript(content, schema, docs, {});
});
Expand All @@ -1392,7 +1392,7 @@ query MyFeed {
outputFile: 'graphql.ts',
})) as Types.ComplexPluginOutput;

expect(content.prepend).toContain(`import * as Operations from './document.graphql.js';`);
expect(content.prepend).toContain(`import * as Operations from './document.graphql';`);
expect(content.content).toBeSimilarStringTo(`export function useTestOneQuery`);
expect(content.content).toBeSimilarStringTo(`export function useTestTwoMutation`);
expect(content.content).toBeSimilarStringTo(`export function useTestThreeSubscription`);
Expand Down

0 comments on commit e305f9b

Please sign in to comment.