Skip to content

Commit

Permalink
feat: remove mock (#5265)
Browse files Browse the repository at this point in the history
* feat: remove mock

* fix: compile error
  • Loading branch information
anxolin authored Jan 9, 2025
1 parent 7a1ce48 commit a5ce229
Show file tree
Hide file tree
Showing 6 changed files with 3 additions and 51 deletions.
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

0 comments on commit a5ce229

Please sign in to comment.