-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #20 from badsyntax/api-mock
Add initial api mocks
- Loading branch information
Showing
81 changed files
with
3,500 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
name-template: '$NEXT_PATCH_VERSION' | ||
tag-template: '$NEXT_PATCH_VERSION' | ||
template: | | ||
$CHANGES |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,19 +1,58 @@ | ||
name: Build | ||
name: Build and Publish | ||
on: | ||
push: | ||
release: | ||
types: [published] | ||
jobs: | ||
validate: | ||
name: Validate | ||
check: | ||
name: Check | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Use Node 12.18.x | ||
uses: actions/setup-node@v1 | ||
with: | ||
node-version: 12.18.x | ||
- name: Install dependencies | ||
run: | | ||
npm install | ||
- name: Lint | ||
run: | | ||
npm run lint | ||
- name: Build | ||
run: | | ||
cat << CONFIG > src/config/config.json | ||
{ | ||
"hostname": "box.example.com", | ||
"mockApi": true | ||
} | ||
CONFIG | ||
npm run build | ||
publish: | ||
needs: [check] | ||
name: Publish | ||
runs-on: ubuntu-latest | ||
if: github.event_name == 'release' && github.event.action == 'published' | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Install dependencies | ||
run: | | ||
npm install | ||
- name: Build | ||
run: | | ||
cat << CONFIG > src/config/config.json | ||
{ | ||
"hostname": "box.example.com", | ||
"mockApi": true | ||
} | ||
CONFIG | ||
PUBLIC_URL=/mailinabox-ui/ npm run build | ||
- name: Publish | ||
run: | | ||
mv build .build | ||
tag=${GITHUB_REF#refs/tags/} | ||
git checkout gh-pages | ||
rm -rf * | ||
mv .build/* . | ||
rm -rf .build | ||
git config user.name github-actions | ||
git config user.email github-actions@github.com | ||
git add . | ||
git commit -m "Add build for version $tag" | ||
git push |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
name: Release Drafter | ||
on: | ||
push: | ||
branches: | ||
- master | ||
jobs: | ||
update-release-draft: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Draft release | ||
uses: release-drafter/release-drafter@v5 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -17,4 +17,4 @@ | |
npm-debug.log* | ||
|
||
# config files | ||
/src/config/index.json | ||
/src/config/config.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import fetchMock from 'fetch-mock'; | ||
import { mocks } from './mocks'; | ||
|
||
Object.keys(mocks).forEach((url) => { | ||
const methods = mocks[url]; | ||
Object.keys(methods).forEach((method) => { | ||
const data = mocks[url][method]; | ||
fetchMock.mock( | ||
{ | ||
url, | ||
method, | ||
delay: 500, | ||
}, | ||
data | ||
); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"response": "updated DNS: example.com" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"response": "updated DNS: example.com" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
{ | ||
"response": "updated DNS: example.com" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"response": [ | ||
{ | ||
"qname": "example.com", | ||
"rtype": "MX", | ||
"value": "10 example.com." | ||
} | ||
] | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
{ | ||
"response": [ | ||
{ | ||
"qname": "example.com", | ||
"rtype": "A", | ||
"value": "11.12.13.14" | ||
}, | ||
{ | ||
"qname": "example.com", | ||
"rtype": "AAAA", | ||
"value": "2a09:4fa:1c1c:e08a::2" | ||
}, | ||
{ | ||
"qname": "example2.com", | ||
"rtype": "A", | ||
"value": "12.13.14.15" | ||
}, | ||
{ | ||
"qname": "blog.example2.com", | ||
"rtype": "A", | ||
"value": "13.14.15.16" | ||
}, | ||
{ | ||
"qname": "www.example3.com", | ||
"rtype": "A", | ||
"value": "13.14.15.16" | ||
}, | ||
{ | ||
"qname": "www.example3.com", | ||
"rtype": "AAAA", | ||
"value": "2a11:8f8:1c1c:b688::1" | ||
}, | ||
{ | ||
"qname": "blog.example3.com", | ||
"rtype": "A", | ||
"value": "13.14.15.16" | ||
}, | ||
{ | ||
"qname": "blog.example3.com", | ||
"rtype": "AAAA", | ||
"value": "2a11:8f8:1c1c:b688::1" | ||
}, | ||
{ | ||
"qname": "example4.com", | ||
"rtype": "A", | ||
"value": "13.14.15.16" | ||
}, | ||
{ | ||
"qname": "example4.com", | ||
"rtype": "AAAA", | ||
"value": "2a11:8f8:1c1c:b688::1" | ||
}, | ||
{ | ||
"qname": "shop.example4.com", | ||
"rtype": "AAAA", | ||
"value": "2a11:8f8:1c1c:b688::1" | ||
}, | ||
{ | ||
"qname": "shop.example4.com", | ||
"rtype": "A", | ||
"value": "13.14.15.16" | ||
}, | ||
{ | ||
"qname": "example5.com", | ||
"rtype": "A", | ||
"value": "13.14.15.16" | ||
}, | ||
{ | ||
"qname": "example5.com", | ||
"rtype": "AAAA", | ||
"value": "2a11:8f8:1c1c:b688::1" | ||
} | ||
] | ||
} |
9 changes: 9 additions & 0 deletions
9
src/api/mocks/dns/data/getDnsCustomRecordsForQNameAndType.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"response": [ | ||
{ | ||
"qname": "example.com", | ||
"rtype": "MX", | ||
"value": "10 example.com." | ||
} | ||
] | ||
} |
Oops, something went wrong.