Skip to content

Commit

Permalink
feat: add more assertions to check for graphql support
Browse files Browse the repository at this point in the history
  • Loading branch information
bombguy committed May 22, 2023
1 parent 55b84ca commit 387fdb9
Showing 1 changed file with 12 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -696,6 +696,18 @@ describe('amplify form renderer tests', () => {
{ isNonModelSupported: true, isRelationshipSupported: false },
);

// check import for graphql operations
expect(componentText).toContain('import { API } from "aws-amplify";');
expect(componentText).toContain('import { getPost } from "../graphql/queries";');
expect(componentText).toContain('import { updatePost } from "../graphql/mutations";');

// should not have DataStore.save call
expect(componentText).not.toContain('await DataStore.save(');

// should call updatePost mutation onSubmit
expect(componentText).toContain(`await API.graphql`);
expect(componentText).toContain(`query: updatePost,`);

expect(componentText).toMatchSnapshot();
});

Expand Down

0 comments on commit 387fdb9

Please sign in to comment.