Skip to content

Commit 7c8923a

Browse files
committed
Create mocks for the entire Admin extension API
1 parent d97bc5a commit 7c8923a

23 files changed

Lines changed: 3948 additions & 3 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,10 @@ jobs:
7070
run: npm install && npm run typecheck && npm test
7171
working-directory: examples/testing/customer-account-testing-example
7272

73+
- name: Testing example (admin)
74+
run: npm install && npm run typecheck && npm test
75+
working-directory: examples/testing/admin-testing-example
76+
7377
test-build:
7478
runs-on: ubuntu-latest
7579

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
# Environment Configuration
2+
.env
3+
.env.*
4+
5+
# Dependency directory
6+
node_modules
7+
8+
# Test coverage directory
9+
coverage
10+
11+
# Ignore Apple macOS Desktop Services Store
12+
.DS_Store
13+
14+
# Logs
15+
logs
16+
*.log
17+
18+
# extensions build output
19+
extensions/*/build
20+
extensions/*/dist
21+
22+
# lock files
23+
24+
25+
26+
27+
# Ignore shopify files created during app dev
28+
.shopify/*
29+
.shopify.lock
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
const fs = require("node:fs");
2+
3+
function getConfig() {
4+
const config = {
5+
projects: {},
6+
};
7+
8+
let extensions = [];
9+
try {
10+
extensions = fs.readdirSync("./extensions");
11+
} catch {
12+
// ignore if no extensions
13+
}
14+
15+
for (const entry of extensions) {
16+
const extensionPath = `./extensions/${entry}`;
17+
const schema = `${extensionPath}/schema.graphql`;
18+
if (!fs.existsSync(schema)) {
19+
continue;
20+
}
21+
config.projects[entry] = {
22+
schema,
23+
documents: [`${extensionPath}/**/*.graphql`],
24+
};
25+
}
26+
27+
return config;
28+
}
29+
30+
module.exports = getConfig();
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
This extension was created with:
2+
3+
```
4+
shopify app init --name admin-testing-example
5+
cd admin-testing-example
6+
shopify app generate extension --template admin_block
7+
```
8+
9+
See it in action:
10+
11+
Build the root package:
12+
13+
```
14+
yarn build
15+
```
16+
17+
Change into this example package and run:
18+
19+
```
20+
npm install
21+
npm run typecheck
22+
npm test
23+
```

examples/testing/admin-testing-example/extensions/.gitkeep

Whitespace-only changes.

0 commit comments

Comments
 (0)