Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: remove mock #5265

Merged
merged 3 commits into from
Jan 9, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 0 additions & 7 deletions apps/cowswap-frontend/.env
Original file line number Diff line number Diff line change
Expand Up @@ -102,13 +102,6 @@ INTEGRATION_TESTS_INFURA_KEY=



#######################################
# Development
#######################################

# Enables mock mode (default = false)
REACT_APP_MOCK=true



#######################################
Expand Down
5 changes: 0 additions & 5 deletions apps/cowswap-frontend/.env.production
Original file line number Diff line number Diff line change
@@ -1,6 +1 @@
#######################################
# Development
#######################################

# Enables mock mode (default = false)
REACT_APP_MOCK=false
2 changes: 1 addition & 1 deletion apps/cowswap-frontend/src/api/cowProtocol/api.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ import { getQuoteValidFor } from 'utils/orderUtils/getQuoteValidFor'
import { ApiErrorCodes } from './errors/OperatorError'
import QuoteApiError, { mapOperatorErrorToQuoteError, QuoteApiErrorDetails } from './errors/QuoteError'
import { getIsOrderBookTypedError } from './getIsOrderBookTypedError'

export { getIsOrderBookTypedError } from './getIsOrderBookTypedError'

function getProfileUrl(): Partial<Record<ChainId, string>> {
if (isLocal || isDev || isPr || isBarn) {
Expand Down
22 changes: 1 addition & 21 deletions apps/cowswap-frontend/src/api/cowProtocol/index.ts
Original file line number Diff line number Diff line change
@@ -1,21 +1 @@
import * as realApi from './api'
import * as mockApi from './mock'

export { getIsOrderBookTypedError } from './getIsOrderBookTypedError'

const useMock = process.env.REACT_APP_MOCK === 'true'

// Re-exporting the result, mocked or not.
// Unfortunately, did not find a way to export
// a mix of mock/real implementations
// without manually naming the exports
export const {
// functions that have a mock
getProfileData,
getQuote = realApi.getQuote,
getOrder = realApi.getOrder,
getNativePrice = realApi.getNativePrice,
getTrades = realApi.getTrades,
getOrders = realApi.getOrders,
// functions that only have a mock
} = useMock ? { ...mockApi } : { ...realApi }
export * from './api'
12 changes: 0 additions & 12 deletions apps/cowswap-frontend/src/api/cowProtocol/mock.ts

This file was deleted.

6 changes: 1 addition & 5 deletions apps/widget-configurator/.env.production
Original file line number Diff line number Diff line change
@@ -1,6 +1,2 @@
#######################################
# Development
#######################################

# Enables mock mode (default = false)
REACT_APP_MOCK=false

Loading