Skip to content

Commit

Permalink
fix: testing mode mock data
Browse files Browse the repository at this point in the history
  • Loading branch information
0xtiti committed Sep 4, 2024
1 parent 5510767 commit 5bab6c3
Show file tree
Hide file tree
Showing 9 changed files with 1,184 additions and 12 deletions.
3 changes: 2 additions & 1 deletion .env.example
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
NEXT_PUBLIC_API_BASE_URL= # Example: https://api.example.com
NEXT_PUBLIC_PROJECT_ID= # ProjectID from WalletConnect
NEXT_PUBLIC_TESTNET_MODE= # true or false
NEXT_PUBLIC_TESTNET_MODE= # true or false
NEXT_PUBLIC_TESTING_MODE= # true or false
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ jobs:
run: |
touch .env
echo "NEXT_PUBLIC_API_BASE_URL=${{ secrets.NEXT_PUBLIC_API_BASE_URL }}" >> .env
echo "NEXT_PUBLIC_TESTING_MODE=${{ secrets.NEXT_PUBLIC_TESTING_MODE }}" >> .env
- name: run Cypress and Jest
uses: cypress-io/github-action@v6
Expand Down
3 changes: 2 additions & 1 deletion cypress/cypress.env.json
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
{
"NEXT_PUBLIC_API_BASE_URL": "http://mock-api:3000"
"NEXT_PUBLIC_API_BASE_URL": "http://mock-api:3000",
"NEXT_PUBLIC_TESTING_MODE": "true"
}
7 changes: 1 addition & 6 deletions cypress/e2e/navigation.cy.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,6 @@
describe('Navigation tests', () => {
beforeEach(() => {
Cypress.env('NEXT_PUBLIC_API_BASE_URL');

// Intercept the API requests and provide mock responses
cy.intercept('GET', '**/metrics/ecosystem', { fixture: 'ecosystemMockData.json' }).as('getEcosystemData');
cy.intercept('GET', '**/metrics/zkchain/*', { fixture: 'chainMockData.json' }).as('getChainData');

Cypress.env('NEXT_PUBLIC_API_BASE_URL', 'NEXT_PUBLIC_TESTING_MODE');
cy.visit('/');
});

Expand Down
2 changes: 2 additions & 0 deletions src/config/env.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,12 @@ export const getEnv = (): Env => {
const NEXT_PUBLIC_PROJECT_ID = process.env.NEXT_PUBLIC_PROJECT_ID;
const NEXT_PUBLIC_API_BASE_URL = process.env.NEXT_PUBLIC_API_BASE_URL;
const NEXT_PUBLIC_TESTNET_MODE = process.env.NEXT_PUBLIC_TESTNET_MODE;
const NEXT_PUBLIC_TESTING_MODE = process.env.NEXT_PUBLIC_TESTING_MODE;

return {
PROJECT_ID: NEXT_PUBLIC_PROJECT_ID as string,
API_URL: NEXT_PUBLIC_API_BASE_URL as string,
TESTNET_MODE: NEXT_PUBLIC_TESTNET_MODE as string,
TESTING_MODE: NEXT_PUBLIC_TESTING_MODE as string,
};
};
Loading

0 comments on commit 5bab6c3

Please sign in to comment.