-
Notifications
You must be signed in to change notification settings - Fork 10
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
Bug/issue 271 determinism #292
Conversation
Hmm.. test is failing on CI because second-post.md is still returned before first-post.md 😞 😠 {
- "Page:6d2fe63686567be": {
+ "Page:9a4ce9aeeb41a94": {
"__typename": "Page"
"fileName": "second-post"
"filePath": "./blog/second-post.md"
- "id": "6d2fe63686567be"
+ "id": "9a4ce9aeeb41a94"
"link": "/blog/second-post"
"template": "blog"
"title": "Blog"
}
- "Page:cc38e1248273d99": {
+ "Page:f3f1bb94286324a": {
"__typename": "Page"
"fileName": "first-post"
"filePath": "./blog/first-post.md"
- "id": "cc38e1248273d99"
+ "id": "f3f1bb94286324a"
"link": "/blog/first-post"
"template": "blog"
"title": "Blog"
} |
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.
So against my prior comment, the order is actually correct I think. Looking at the build The expected and actual both have second post after first post. ex.
AssertionError: expected '\n window.__APOLLO_STATE__={"Page:cc38e1248273d99":{"id":"cc38e1248273d99","title":"Blog","link":"/blog/first-post","filePath":"./blog/first-post.md","fileName":"first-post","template":"blog","__typename":"Page"},"Page:6d2fe63686567be":{"id":"6d2fe63686567be","title":"Blog","link":"/blog/second-post","filePath":"./blog/second-post.md","fileName":"second-post","template":"blog","__typename":"Page"},"ROOT_QUERY":{"children({\\"parent\\":\\"blog\\"})":[{"type":"id","generated":false,"id":"Page:cc38e1248273d99","typename":"Page"},{"type":"id","generated":false,"id":"Page:6d2fe63686567be","typename":"Page"}],"navigation":[{"type":"id","generated":true,"id":"ROOT_QUERY.navigation.0","typename":"Navigation"}]},"ROOT_QUERY.navigation.0":{"label":"Blog","link":"/blog/","__typename":"Navigation"}};\n ' to include 'window.__APOLLO_STATE__={"ROOT_QUERY.navigation.0":{"label":"Blog","link":"/blog/","__typename":"Navigation"},"ROOT_QUERY":{"navigation":[{"type":"id","generated":true,"id":"ROOT_QUERY.navigation.0","typename":"Navigation"}],"children({\\"parent\\":\\"blog\\"})":[{"type":"id","generated":false,"id":"Page:f3f1bb94286324a","typename":"Page"},{"type":"id","generated":false,"id":"Page:9a4ce9aeeb41a94","typename":"Page"}]},"Page:f3f1bb94286324a":{"id":"f3f1bb94286324a","title":"Blog","link":"/blog/first-post","filePath":"./blog/first-post.md","fileName":"first-post","template":"blog","__typename":"Page"},"Page:9a4ce9aeeb41a94":{"id":"9a4ce9aeeb41a94","title":"Blog","link":"/blog/second-post","filePath":"./blog/second-post.md","fileName":"second-post","template":"blog","__typename":"Page"}}'
So looking at them more closely, the issue isn't the the order, but rather the overall shape of the objects, which is something specific to GraphQL / Apollo.
I think I just need to relax my expectations of what is coming out of GraphQL and just leverage our unit tests more, which is the better place to capture specific APIs that our users will actually be using and not focus so much on things like Page id
and hash values, as well as all the unique keys that GraphQL creates. How data comes in / out of GraphQL is more of an implementation details of our libraries.
So we should do as good as we can to validate the output in index.html, but if we go to granular, it will always just be a game of whack-a-mole. Will test for pages order, which is what we care about the most from this output.
f51b836
to
21ffa99
Compare
* graphql server working * apollo client connect to apollo server * connected header example using lit apollo * todo * todos * query and client + server refactor * schema refactoring * clean up console logging * alias all @greenwood/cli/data module imports * avoid paramater destructuring * graphql example in the header * multiple schemas * internal data sources documentation * shelf refactor and children query integration * refactor out ApolloQuery * ability to intercept client.query calls * basic semi-working implementation * remove extra config from server context * have puppeteer wait for graphql requests before returning content * fix and add test cases for apollo * merged resolvers not actually working * multiple queries support * everything working * todos * TODO tracking * fix fallback apollo client fetch handling * full test suite * cache json test cases * stablize test due to inconsistent data results ordering * clean up deps * todo cleanup * remove forced client call in SSG mode for client * represent graph through the schema * updated data docs * typos and grammer * typos and community link fixes
c81db68
to
5d4b836
Compare
Merging per consensus reached during the last project meeting and no standing objections / comments on this PR. |
* Rfc/issue 115 build time data access (#269) * graphql server working * apollo client connect to apollo server * connected header example using lit apollo * todo * todos * query and client + server refactor * schema refactoring * clean up console logging * alias all @greenwood/cli/data module imports * avoid paramater destructuring * graphql example in the header * multiple schemas * internal data sources documentation * shelf refactor and children query integration * refactor out ApolloQuery * ability to intercept client.query calls * basic semi-working implementation * remove extra config from server context * have puppeteer wait for graphql requests before returning content * fix and add test cases for apollo * merged resolvers not actually working * multiple queries support * everything working * todos * TODO tracking * fix fallback apollo client fetch handling * full test suite * cache json test cases * stablize test due to inconsistent data results ordering * clean up deps * todo cleanup * remove forced client call in SSG mode for client * represent graph through the schema * updated data docs * typos and grammer * typos and community link fixes * unit test data graph * linting * lint fix * added ordered index tracking when serializing pages * formatting * document graph page ordering * cli data graph unit tests and expand mocha spec globbing * address missing hash in mock graph * loosen graph test case asserts * update graph tests to focus less on implementation details * add back missing develop task
* Rfc/issue 115 build time data access (#269) * graphql server working * apollo client connect to apollo server * connected header example using lit apollo * todo * todos * query and client + server refactor * schema refactoring * clean up console logging * alias all @greenwood/cli/data module imports * avoid paramater destructuring * graphql example in the header * multiple schemas * internal data sources documentation * shelf refactor and children query integration * refactor out ApolloQuery * ability to intercept client.query calls * basic semi-working implementation * remove extra config from server context * have puppeteer wait for graphql requests before returning content * fix and add test cases for apollo * merged resolvers not actually working * multiple queries support * everything working * todos * TODO tracking * fix fallback apollo client fetch handling * full test suite * cache json test cases * stablize test due to inconsistent data results ordering * clean up deps * todo cleanup * remove forced client call in SSG mode for client * represent graph through the schema * updated data docs * typos and grammer * typos and community link fixes * unit test data graph * linting * lint fix * added ordered index tracking when serializing pages * formatting * document graph page ordering * cli data graph unit tests and expand mocha spec globbing * address missing hash in mock graph * loosen graph test case asserts * update graph tests to focus less on implementation details * add back missing develop task
* Rfc/issue 115 build time data access (#269) * graphql server working * apollo client connect to apollo server * connected header example using lit apollo * todo * todos * query and client + server refactor * schema refactoring * clean up console logging * alias all @greenwood/cli/data module imports * avoid paramater destructuring * graphql example in the header * multiple schemas * internal data sources documentation * shelf refactor and children query integration * refactor out ApolloQuery * ability to intercept client.query calls * basic semi-working implementation * remove extra config from server context * have puppeteer wait for graphql requests before returning content * fix and add test cases for apollo * merged resolvers not actually working * multiple queries support * everything working * todos * TODO tracking * fix fallback apollo client fetch handling * full test suite * cache json test cases * stablize test due to inconsistent data results ordering * clean up deps * todo cleanup * remove forced client call in SSG mode for client * represent graph through the schema * updated data docs * typos and grammer * typos and community link fixes * Bug/issue 271 determinism (#292) * Rfc/issue 115 build time data access (#269) * graphql server working * apollo client connect to apollo server * connected header example using lit apollo * todo * todos * query and client + server refactor * schema refactoring * clean up console logging * alias all @greenwood/cli/data module imports * avoid paramater destructuring * graphql example in the header * multiple schemas * internal data sources documentation * shelf refactor and children query integration * refactor out ApolloQuery * ability to intercept client.query calls * basic semi-working implementation * remove extra config from server context * have puppeteer wait for graphql requests before returning content * fix and add test cases for apollo * merged resolvers not actually working * multiple queries support * everything working * todos * TODO tracking * fix fallback apollo client fetch handling * full test suite * cache json test cases * stablize test due to inconsistent data results ordering * clean up deps * todo cleanup * remove forced client call in SSG mode for client * represent graph through the schema * updated data docs * typos and grammer * typos and community link fixes * unit test data graph * linting * lint fix * added ordered index tracking when serializing pages * formatting * document graph page ordering * cli data graph unit tests and expand mocha spec globbing * address missing hash in mock graph * loosen graph test case asserts * update graph tests to focus less on implementation details * add back missing develop task * task: refactor into single menu query, enable menu filtering with markdown declarations * fix shelf * fix: shelf rendering collapse/expand * test: update al related tests * fix: remove debug * task: basic sorting label/index * fix: index sorting * fix: remove debug * fix: current tests * test: amending tests, removing prev mock * test: revert previous graphql test case * test: remove hello query * fix: remove deprecated .json files * fix: refactor mock graph func * test: adding sort/filter menu tests * task: add documentation for menus * fix: amend documentation * fix: amend docs for route var * fix: typo * task: add headingLevel and route condition, remove hardcoded vars * fix: non-pathname menus may want linkheadings children * task: amend docs for child heading level * fix: change linkheadings to integer, use for headingLevel * docs: remove navigation query docs * test: fix test * task: revert stub generation code * fix: update data sources doc * fix: amend docs for route/linkheadings additions * fix: update filter to use title instead of label * fix: test * task: update docs with linkheadings query result Co-authored-by: Owen Buckley <[email protected]>
Related Issue
resolves #271
Summary of Changes
pages
Array to that index, instead of asynchronously being pushed . Was trying to do something fancy like this but couldn't get it to work.Notes
had to extend Mocha glob configuration, which is making the- see Technical/issue 293 mocha refactor #294test
andtest:tdd
tasks a little cumbersome to maintain now. Will create a new issue for refactoring this configuration to use a mocharc.js fileMOCK_GRAPH