Skip to content

Commit

Permalink
refactor: move all tests inside tests folder (#35)
Browse files Browse the repository at this point in the history
# 🤖 Linear

Closes ZKS-135

## Description

Move all tests under /test folder, sibling to the corresponding module
src folder
  • Loading branch information
0xnigir1 authored Aug 2, 2024
1 parent d6e1dab commit 54562eb
Show file tree
Hide file tree
Showing 6 changed files with 7 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { INestApplication } from "@nestjs/common";
import { Test, TestingModule } from "@nestjs/testing";
import request from "supertest";

import { ApiModule } from "../src/api.module";
import { ApiModule } from "../../src/api.module";

describe("MetricsController (e2e)", () => {
let app: INestApplication;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,8 @@ import { Test, TestingModule } from "@nestjs/testing";
import { WINSTON_MODULE_PROVIDER } from "nest-winston";
import { Logger } from "winston";

import { MetricsController } from "./metrics.controller";
import { getEcosystemInfo, getZKChainInfo } from "./mocks/metrics.mock";
import { MetricsController } from "../../../src/metrics/metrics.controller";
import { getEcosystemInfo, getZKChainInfo } from "../../../src/metrics/mocks/metrics.mock";

export const mockLogger: Partial<Logger> = {
log: jest.fn(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,12 @@ import { Logger } from "@nestjs/common";
import { Test, TestingModule } from "@nestjs/testing";
import { WINSTON_MODULE_PROVIDER } from "nest-winston";

import { L1MetricsService } from "@zkchainhub/metrics/l1/";
import { bridgeHubAbi, sharedBridgeAbi } from "@zkchainhub/metrics/l1/abis";
import { IPricingService, PRICING_PROVIDER } from "@zkchainhub/pricing";
import { EvmProviderService } from "@zkchainhub/providers";
import { L1_CONTRACTS } from "@zkchainhub/shared";

import { L1MetricsService } from "./l1MetricsService";

// Mock implementations of the dependencies
const mockEvmProviderService = {
// Mock methods and properties as needed
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ import MockAdapter from "axios-mock-adapter";
import { WINSTON_MODULE_PROVIDER } from "nest-winston";

import { ApiNotAvailable, RateLimitExceeded } from "@zkchainhub/pricing/exceptions";
import { CoingeckoService, DECIMALS_PRECISION } from "@zkchainhub/pricing/services";
import { TokenPrices } from "@zkchainhub/pricing/types/tokenPrice.type";
import { BASE_CURRENCY } from "@zkchainhub/shared";

import { CoingeckoService, DECIMALS_PRECISION } from "./coingecko.service";

export const mockLogger: Partial<Logger> = {
log: jest.fn(),
warn: jest.fn(),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,13 @@ import * as viem from "viem";
import { localhost } from "viem/chains";
import { Logger } from "winston";

import { EvmProviderService } from "@zkchainhub/providers";
import { DataDecodeException } from "@zkchainhub/providers/exceptions";
import {
arrayAbiFixture,
structAbiFixture,
} from "@zkchainhub/providers/fixtures/batchRequest.fixture";

import { EvmProviderService } from "./evmProvider.service";

const mockClient = createMock<ReturnType<typeof viem.createPublicClient>>();

jest.mock("viem", () => ({
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@ import { localhost } from "viem/chains";
import { GetL1BatchDetailsReturnType } from "viem/zksync";
import { Logger } from "winston";

import { ZKChainProviderService } from "@zkchainhub/providers";
import { InvalidArgumentException } from "@zkchainhub/providers/exceptions";

import { ZKChainProviderService } from "./zkChainProvider.service";

export const mockLogger: Partial<Logger> = {
log: jest.fn(),
warn: jest.fn(),
Expand Down

0 comments on commit 54562eb

Please sign in to comment.