Skip to content

Commit

Permalink
chore(tests): generated test for each example (#1041)
Browse files Browse the repository at this point in the history
  • Loading branch information
jasonkuhrt authored Aug 23, 2024
1 parent eeb59e9 commit e9ab5cb
Show file tree
Hide file tree
Showing 20 changed files with 471 additions and 19 deletions.
5 changes: 5 additions & 0 deletions examples/arguments.output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[
{ name: 'Canada', continent: { name: 'North America' } },
{ name: 'Germany', continent: { name: 'Europe' } },
{ name: 'Japan', continent: { name: 'Asia' } }
]
1 change: 1 addition & 0 deletions examples/config-fetch.output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
[ { name: 'Canada Mocked!' } ]
9 changes: 9 additions & 0 deletions examples/config-http-headers.output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[
{ name: 'Africa' },
{ name: 'Antarctica' },
{ name: 'Asia' },
{ name: 'Europe' },
{ name: 'North America' },
{ name: 'Oceania' },
{ name: 'South America' }
]
10 changes: 10 additions & 0 deletions examples/raw-typed.output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[
{ name: 'Canada', continent: { name: 'North America' } },
{ name: 'Germany', continent: { name: 'Europe' } },
{ name: 'Japan', continent: { name: 'Asia' } }
]
[
{ name: 'Canada', continent: { name: 'North America' } },
{ name: 'Germany', continent: { name: 'Europe' } },
{ name: 'Japan', continent: { name: 'Asia' } }
]
7 changes: 7 additions & 0 deletions examples/raw.output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
{
countries: [
{ name: 'Canada', continent: { name: 'North America' } },
{ name: 'Germany', continent: { name: 'Europe' } },
{ name: 'Japan', continent: { name: 'Asia' } }
]
}
5 changes: 5 additions & 0 deletions examples/rawString-typed.output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[
{ name: 'Canada', continent: { name: 'North America' } },
{ name: 'Germany', continent: { name: 'Europe' } },
{ name: 'Japan', continent: { name: 'Asia' } }
]
105 changes: 105 additions & 0 deletions examples/rawString.output.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,105 @@
{
countries: [
{ name: 'Andorra' },
{ name: 'United Arab Emirates' },
{ name: 'Afghanistan' },
{ name: 'Antigua and Barbuda' },
{ name: 'Anguilla' },
{ name: 'Albania' },
{ name: 'Armenia' },
{ name: 'Angola' },
{ name: 'Antarctica' },
{ name: 'Argentina' },
{ name: 'American Samoa' },
{ name: 'Austria' },
{ name: 'Australia' },
{ name: 'Aruba' },
{ name: 'Åland' },
{ name: 'Azerbaijan' },
{ name: 'Bosnia and Herzegovina' },
{ name: 'Barbados' },
{ name: 'Bangladesh' },
{ name: 'Belgium' },
{ name: 'Burkina Faso' },
{ name: 'Bulgaria' },
{ name: 'Bahrain' },
{ name: 'Burundi' },
{ name: 'Benin' },
{ name: 'Saint Barthélemy' },
{ name: 'Bermuda' },
{ name: 'Brunei' },
{ name: 'Bolivia' },
{ name: 'Bonaire' },
{ name: 'Brazil' },
{ name: 'Bahamas' },
{ name: 'Bhutan' },
{ name: 'Bouvet Island' },
{ name: 'Botswana' },
{ name: 'Belarus' },
{ name: 'Belize' },
{ name: 'Canada' },
{ name: 'Cocos [Keeling] Islands' },
{ name: 'Democratic Republic of the Congo' },
{ name: 'Central African Republic' },
{ name: 'Republic of the Congo' },
{ name: 'Switzerland' },
{ name: 'Ivory Coast' },
{ name: 'Cook Islands' },
{ name: 'Chile' },
{ name: 'Cameroon' },
{ name: 'China' },
{ name: 'Colombia' },
{ name: 'Costa Rica' },
{ name: 'Cuba' },
{ name: 'Cape Verde' },
{ name: 'Curacao' },
{ name: 'Christmas Island' },
{ name: 'Cyprus' },
{ name: 'Czech Republic' },
{ name: 'Germany' },
{ name: 'Djibouti' },
{ name: 'Denmark' },
{ name: 'Dominica' },
{ name: 'Dominican Republic' },
{ name: 'Algeria' },
{ name: 'Ecuador' },
{ name: 'Estonia' },
{ name: 'Egypt' },
{ name: 'Western Sahara' },
{ name: 'Eritrea' },
{ name: 'Spain' },
{ name: 'Ethiopia' },
{ name: 'Finland' },
{ name: 'Fiji' },
{ name: 'Falkland Islands' },
{ name: 'Micronesia' },
{ name: 'Faroe Islands' },
{ name: 'France' },
{ name: 'Gabon' },
{ name: 'United Kingdom' },
{ name: 'Grenada' },
{ name: 'Georgia' },
{ name: 'French Guiana' },
{ name: 'Guernsey' },
{ name: 'Ghana' },
{ name: 'Gibraltar' },
{ name: 'Greenland' },
{ name: 'Gambia' },
{ name: 'Guinea' },
{ name: 'Guadeloupe' },
{ name: 'Equatorial Guinea' },
{ name: 'Greece' },
{ name: 'South Georgia and the South Sandwich Islands' },
{ name: 'Guatemala' },
{ name: 'Guam' },
{ name: 'Guinea-Bissau' },
{ name: 'Guyana' },
{ name: 'Hong Kong' },
{ name: 'Heard Island and McDonald Islands' },
{ name: 'Honduras' },
{ name: 'Croatia' },
{ name: 'Haiti' },
{ name: 'Hungary' },
... 150 more items
]
}
4 changes: 4 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@
"scripts": {
"graffle": "tsx ./src/cli/generate.ts",
"gen:test:schema": "tsx tests/_/schemaGenerate.ts",
"gen:test:examples": "tsx scripts/generate-test-examples.ts",
"gen:docs:examples:clients:SocialStudies": "pnpm graffle --name SocialStudies --schema https://countries.trevorblades.com/graphql --output ./examples/generated-clients/SocialStudies --libraryPathClient ../../../src/entrypoints/graffle/client.js --libraryPathSchema ../../../src/entrypoints/graffle/schema.js --libraryPathScalars ../../../src/entrypoints/graffle/scalars.js",
"dev": "rm -rf dist && tsc --watch",
"format": "pnpm build:docs && dprint fmt",
Expand Down Expand Up @@ -133,7 +134,9 @@
"eslint-plugin-simple-import-sort": "^12.1.1",
"eslint-plugin-tsdoc": "^0.3.0",
"eslint-typescript": "^1.1.0",
"execa": "^9.3.1",
"get-port": "^7.1.0",
"globby": "^14.0.2",
"graphql": "^16.9.0",
"graphql-scalars": "^1.23.0",
"graphql-tag": "^2.12.6",
Expand All @@ -142,6 +145,7 @@
"jsdom": "^24.1.1",
"json-bigint": "^1.0.0",
"publint": "^0.2.10",
"strip-ansi": "^7.1.0",
"tsx": "^4.17.0",
"type-fest": "^4.25.0",
"typescript": "^5.5.4",
Expand Down
Loading

0 comments on commit e9ab5cb

Please # to comment.