-
Notifications
You must be signed in to change notification settings - Fork 63
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add e2e tests for codegen add when in a non-amplify project #705
Conversation
expect(existsSync(userSourceCodePath)).toBe(true); | ||
// GraphQL statements are generated | ||
const generatedStatementFiles = new Set(readdirSync(path.join(projectRoot, config.graphqlCodegenDir))); | ||
console.log(`Comparing written files: ${JSON.stringify(Array.from(generatedStatementFiles))} to expected files: ${JSON.stringify(expectedFilenames)}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we need to log both arrays here as they are compared on the next line?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yeah, this'll make debugging easier because the comparison line below fails w/ no indication of what the mismatch was,.
|
||
// GraphQL statements are regenerated | ||
const regeneratedStatementFiles = new Set(readdirSync(path.join(projectRoot, config.graphqlCodegenDir))); | ||
console.log(`Comparing written files: ${JSON.stringify(Array.from(regeneratedStatementFiles))} to expected files: ${JSON.stringify(expectedFilenames)}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 Same as above
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
^ same
|
||
// GraphQL statements are regenerated | ||
const regeneratedStatementFiles = new Set(readdirSync(path.join(projectRoot, config.graphqlCodegenDir))); | ||
console.log(`Comparing written files: ${JSON.stringify(Array.from(regeneratedStatementFiles))} to expected files: ${JSON.stringify(expectedFilenames)}`); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+2
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
:D
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I've pulled this into a utility method to reduce the duplication in this function.
1e421b6
to
60c1225
Compare
…set up locally. (#702) * feat: codegen add --region (#683) * fix: download introspection schema when apiId is passed (#684) * fix: codegen --apiId broken state (#689) * chore: get existing e2e tests passing (#704) * feat: add e2e tests for codegen add when in a non-amplify project (#705) * feat: add e2e tests for codegen add when in a non-amplify project * chore: add some additional test cases * noinit codegen from graphqlconfig (#706) * fix: add missing awaits * chore: fail typegen if no queries are found --------- Co-authored-by: Dane Pilcher <[email protected]>
Description of changes
Added e2e test cases for codegen add in an uninitialized project. These don't yet include test cases where we download an existing api sdl schema.
Issue #, if available
N/A
Description of how you validated changes
E2E Tests pass
Checklist
yarn test
passesBy submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.