Skip to content
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

fix(recipes): Fix shadow-file resource for scoped NPM packages & re-enable e2e testing for resources #23274

Merged
merged 14 commits into from
Apr 20, 2020
Merged
4 changes: 4 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -205,12 +205,16 @@ jobs:

unit_tests_node10:
executor: node
environment:
FORCE_COLOR: 0
<<: *test_template

unit_tests_node12:
executor:
name: node
image: "12"
environment:
FORCE_COLOR: 0
<<: *test_template

unit_tests_www:
Expand Down
2 changes: 2 additions & 0 deletions packages/gatsby-recipes/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,9 @@ Soon will support options.

#### `<GatsbyShadowFile>`

```jsx
<GatsbyShadowFile theme="gatsby-theme-blog" path="src/components/seo.js" />
```

##### props

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,225 @@
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`file resource e2e file resource test: File create 1`] = `
Object {
"_message": "Wrote file file.txt",
"content": "Hello, world!",
"id": "file.txt",
"path": "file.txt",
}
`;

exports[`file resource e2e file resource test: File create plan 1`] = `
Object {
"currentState": "",
"describe": "Write file.txt",
"diff": "- Original - 0
+ Modified + 1

+ Hello, world!",
"newState": "Hello, world!",
}
`;

exports[`file resource e2e file resource test: File destroy 1`] = `
Object {
"_message": "Wrote file file.txt",
"content": "Hello, world!1",
"id": "file.txt",
"path": "file.txt",
}
`;

exports[`file resource e2e file resource test: File update 1`] = `
Object {
"_message": "Wrote file file.txt",
"content": "Hello, world!1",
"id": "file.txt",
"path": "file.txt",
}
`;

exports[`file resource e2e file resource test: File update plan 1`] = `
Object {
"currentState": "Hello, world!",
"describe": "Write file.txt",
"diff": "- Original - 1
+ Modified + 1

- Hello, world!
+ Hello, world!1",
"newState": "Hello, world!1",
}
`;

exports[`file resource e2e remote file resource test: File create 1`] = `
Object {
"_message": "Wrote file file.txt",
"content": "query {
allGatsbyPlugin {
nodes {
name
options
resolvedOptions
package {
version
}
... on GatsbyTheme {
files {
nodes {
path
}
}
shadowedFiles {
nodes {
path
}
}
}
}
}
}",
"id": "file.txt",
"path": "file.txt",
}
`;

exports[`file resource e2e remote file resource test: File create plan 1`] = `
Object {
"currentState": "",
"describe": "Write file.txt",
"diff": "- Original - 0
+ Modified + 24

+ query {
+ allGatsbyPlugin {
+ nodes {
+ name
+ options
+ resolvedOptions
+ package {
+ version
+ }
+ ... on GatsbyTheme {
+ files {
+ nodes {
+ path
+ }
+ }
+ shadowedFiles {
+ nodes {
+ path
+ }
+ }
+ }
+ }
+ }
+ }",
"newState": "query {
allGatsbyPlugin {
nodes {
name
options
resolvedOptions
package {
version
}
... on GatsbyTheme {
files {
nodes {
path
}
}
shadowedFiles {
nodes {
path
}
}
}
}
}
}",
}
`;

exports[`file resource e2e remote file resource test: File destroy 1`] = `
Object {
"_message": "Wrote file file.txt",
"content": "https://gist.githubusercontent.com/KyleAMathews/3d763491e5c4c6396e1a6a626b2793ce/raw/545120bfecbe7b0f97f6f021801bc8b6370b5b41/gistfile2.txt",
"id": "file.txt",
"path": "file.txt",
}
`;

exports[`file resource e2e remote file resource test: File update 1`] = `
Object {
"_message": "Wrote file file.txt",
"content": "https://gist.githubusercontent.com/KyleAMathews/3d763491e5c4c6396e1a6a626b2793ce/raw/545120bfecbe7b0f97f6f021801bc8b6370b5b41/gistfile2.txt",
"id": "file.txt",
"path": "file.txt",
}
`;

exports[`file resource e2e remote file resource test: File update plan 1`] = `
Object {
"currentState": "query {
allGatsbyPlugin {
nodes {
name
options
resolvedOptions
package {
version
}
... on GatsbyTheme {
files {
nodes {
path
}
}
shadowedFiles {
nodes {
path
}
}
}
}
}
}",
"describe": "Write file.txt",
"diff": "- Original - 23
+ Modified + 3

- query {
- allGatsbyPlugin {
- nodes {
- name
- options
- resolvedOptions
- package {
- version
- }
- ... on GatsbyTheme {
- files {
- nodes {
- path
- }
- }
- shadowedFiles {
- nodes {
- path
- }
- }
- }
- }
- }
+ const options = {
+ key: process.env.WHATEVER
+
}",
"newState": "const options = {
key: process.env.WHATEVER

}",
}
`;
Loading