Skip to content

Commit 0cf296f

Browse files
committed
feat(test): add test gatsby site from gatsby-functions plugin
1 parent 360194e commit 0cf296f

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

63 files changed

+1308
-0
lines changed

test/fixtures/.env.development

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pickle=word

test/fixtures/.env.production

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
pickle=word

test/fixtures/.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
node_modules/
2+
.cache/
3+
public
4+
5+
# Local Netlify folder
6+
.netlify
7+
8+
netlify/functions/gatsby/functions
9+
deployment.json

test/fixtures/README.md

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
<p align="center">
2+
<a href="https://www.gatsbyjs.com/?utm_source=starter&utm_medium=readme&utm_campaign=minimal-starter">
3+
<img alt="Gatsby" src="https://www.gatsbyjs.com/Gatsby-Monogram.svg" width="60" />
4+
</a>
5+
</p>
6+
<h1 align="center">
7+
Gatsby minimal starter
8+
</h1>
9+
10+
## 🚀 Quick start
11+
12+
1. **Create a Gatsby site.**
13+
14+
Use the Gatsby CLI to create a new site, specifying the minimal starter.
15+
16+
```shell
17+
# create a new Gatsby site using the minimal starter
18+
npm init gatsby
19+
```
20+
21+
2. **Start developing.**
22+
23+
Navigate into your new site’s directory and start it up.
24+
25+
```shell
26+
cd my-gatsby-site/
27+
npm run develop
28+
```
29+
30+
3. **Open the code and start customizing!**
31+
32+
Your site is now running at http://localhost:8000!
33+
34+
Edit `src/pages/index.js` to see your site update in real-time!
35+
36+
4. **Learn more**
37+
38+
- [Documentation](https://www.gatsbyjs.com/docs/?utm_source=starter&utm_medium=readme&utm_campaign=minimal-starter)
39+
40+
- [Tutorials](https://www.gatsbyjs.com/tutorial/?utm_source=starter&utm_medium=readme&utm_campaign=minimal-starter)
41+
42+
- [Guides](https://www.gatsbyjs.com/tutorial/?utm_source=starter&utm_medium=readme&utm_campaign=minimal-starter)
43+
44+
- [API Reference](https://www.gatsbyjs.com/docs/api-reference/?utm_source=starter&utm_medium=readme&utm_campaign=minimal-starter)
45+
46+
- [Plugin Library](https://www.gatsbyjs.com/plugins?utm_source=starter&utm_medium=readme&utm_campaign=minimal-starter)
47+
48+
- [Cheat Sheet](https://www.gatsbyjs.com/docs/cheat-sheet/?utm_source=starter&utm_medium=readme&utm_campaign=minimal-starter)
49+
50+
## 🚀 Quick start (Gatsby Cloud)
51+
52+
Deploy this starter with one click on [Gatsby Cloud](https://www.gatsbyjs.com/cloud/):
53+
54+
[<img src="https://www.gatsbyjs.com/deploynow.svg" alt="Deploy to Gatsby Cloud">](https://www.gatsbyjs.com/dashboard/deploynow?url=https://github.com/gatsbyjs/gatsby-starter-minimal)
Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
// Jest Snapshot v1, https://goo.gl/fbAQLP
2+
3+
exports[`Local functions can parse different ways of sending data form data 1`] = `
4+
Object {
5+
"a": "form-data",
6+
}
7+
`;
8+
9+
exports[`Local functions can parse different ways of sending data form parameters 1`] = `
10+
Object {
11+
"a": "form parameters",
12+
}
13+
`;
14+
15+
exports[`Local functions can parse different ways of sending data json body 1`] = `
16+
Object {
17+
"a": "json",
18+
}
19+
`;
20+
21+
exports[`Local functions can parse different ways of sending data query string 1`] = `
22+
Object {
23+
"amIReal": "true",
24+
}
25+
`;
26+
27+
exports[`Local functions get parsed cookies cookie 1`] = `
28+
Object {
29+
"foo": "blue",
30+
}
31+
`;
32+
33+
exports[`Local response formats returns json correctly: headers 1`] = `
34+
Object {
35+
"connection": "close",
36+
"content-type": "application/json",
37+
"transfer-encoding": "chunked",
38+
"x-powered-by": "Express",
39+
}
40+
`;
41+
42+
exports[`Local response formats returns json correctly: result 1`] = `
43+
Object {
44+
"amIJSON": true,
45+
}
46+
`;
47+
48+
exports[`Local response formats returns text correctly: headers 1`] = `
49+
Object {
50+
"connection": "close",
51+
"transfer-encoding": "chunked",
52+
"x-powered-by": "Express",
53+
}
54+
`;
55+
56+
exports[`Local response formats returns text correctly: result 1`] = `"I am typescript"`;
57+
58+
exports[`Local routing dynamic routes 1`] = `
59+
Object {
60+
"super": "additional",
61+
"userId": "23",
62+
}
63+
`;
64+
65+
exports[`Local routing dynamic routes 2`] = `
66+
Object {
67+
"0": "super",
68+
}
69+
`;
70+
71+
exports[`Local routing routes with special characters 1`] = `"I-Am-Capitalized.js"`;
72+
73+
exports[`Local routing routes with special characters 2`] = `"some whitespace.js"`;
74+
75+
exports[`Local routing routes with special characters 3`] = `"with-äöü-umlaut.js"`;
76+
77+
exports[`Local routing routes with special characters 4`] = `"some-àè-french.js"`;
78+
79+
exports[`Local routing routes with special characters 5`] = `"some-אודות.js"`;
80+
81+
exports[`Local routing secondary-level API 1`] = `"I am at a secondary-level"`;
82+
83+
exports[`Local routing secondary-level API 2`] = `"I am another sub-directory function"`;
84+
85+
exports[`Local routing secondary-level API with index.js 1`] = `"I am an index.js in a sub-directory!"`;
86+
87+
exports[`Local routing top-level API 1`] = `"I am at the top-level"`;
88+
89+
exports[`Local typescript typescript functions work 1`] = `"I am typescript"`;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
const { runTests } = require("./test-helpers");
2+
3+
if (process.env.TEST_ENV === "netlify") {
4+
const { deploy_url } = require("../deployment.json");
5+
runTests("Netlify", deploy_url);
6+
} else {
7+
runTests("Local", "http://localhost:8888");
8+
}

0 commit comments

Comments
 (0)