Skip to content

Commit

Permalink
test(coverage): api config with base token
Browse files Browse the repository at this point in the history
  • Loading branch information
SantiagoPittella committed Apr 16, 2024
1 parent 2af72cf commit 0ac3a04
Showing 1 changed file with 54 additions and 0 deletions.
54 changes: 54 additions & 0 deletions packages/api/src/config/index.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,60 @@ describe("config", () => {
});
});

it("sets default values with base ERC20", () => {
process.env = {
BASE_TOKEN_SYMBOL: "MTTL",
BASE_TOKEN_DECIMALS: "18",
BASE_TOKEN_L1_ADDRESS: "0xSomeAddress",
BASE_TOKEN_ICON_URL: "https://matter-labs.io",
BASE_TOKEN_NAME: "MatterLabs",
BASE_TOKEN_LIQUIDITY: "999999999999",
BASE_TOKEN_USDPRICE: "19",
NODE_ENV: "test",
};

expect(config()).toEqual({
baseTokenData: {
l2Address: "0x000000000000000000000000000000000000800A",
l1Address: "0xSomeAddress",
symbol: "MTTL",
name: "MatterLabs",
decimals: 18,
// Fallback data in case ETH token is not in the DB
iconURL: "https://matter-labs.io",
liquidity: 999999999999,
usdPrice: 19,
},
NODE_ENV: "test",
port: 3020,
metrics: {
port: 3005,
collectDbConnectionPoolMetricsInterval: 10000,
},
typeORM: {
type: "postgres",
url: "postgres://postgres:[email protected]:5432/block-explorer",
poolSize: 300,
extra: {
idleTimeoutMillis: 60000,
statement_timeout: 90000,
},
synchronize: true,
logging: false,
autoLoadEntities: true,
retryAttempts: 10,
retryDelay: 3000,
applicationName: "block-explorer-api",
},
contractVerificationApiUrl: "http://127.0.0.1:3070",
featureFlags: {
feature1Enabled: true,
feature2Enabled: false,
},
gracefulShutdownTimeoutMs: 0,
});
});

it("sets replication DB config if replica set exists", () => {
process.env.DATABASE_REPLICA_URL_0 = "DATABASE_REPLICA_URL_0";
process.env.DATABASE_REPLICA_URL_1 = "DATABASE_REPLICA_URL_1";
Expand Down

0 comments on commit 0ac3a04

Please sign in to comment.