Skip to content

Commit

Permalink
Apply linting rule enforcement onto test files
Browse files Browse the repository at this point in the history
  • Loading branch information
marvinruder committed Sep 25, 2023
1 parent 1fce0db commit d7e56f7
Show file tree
Hide file tree
Showing 6 changed files with 13 additions and 9 deletions.
2 changes: 1 addition & 1 deletion packages/backend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"prisma:migrate:dev": "pnpify prisma migrate dev",
"build": "esbuild --color=true src/server.ts --bundle --platform=node --format=esm --legal-comments=none --banner:js=\"import __path from'path';import{createRequire as __createRequire}from'module';import{fileURLToPath}from'url';const require=__createRequire(import.meta.url),__filename=fileURLToPath(import.meta.url),__dirname=__path.dirname(__filename);\" --outfile=dist/server.mjs",
"typecheck": "tsc --noEmit --tsBuildInfoFile $HOME/.cache/rating-tracker/backend.tsbuildinfo",
"lint": "eslint --color --cache --cache-location $HOME/.cache/rating-tracker/backend.eslintcache --cache-strategy content --max-warnings 0 --ext .ts src/",
"lint": "eslint --color --cache --cache-location $HOME/.cache/rating-tracker/backend.eslintcache --cache-strategy content --max-warnings 0 --ext .ts src/ test/",
"lint:fix": "yarn lint --fix"
},
"dependencies": {
Expand Down
10 changes: 6 additions & 4 deletions packages/backend/test/live.test.ts
Original file line number Diff line number Diff line change
@@ -1,17 +1,19 @@
import applyPostgresSeeds from "./seeds/postgres";
import applyRedisSeeds from "./seeds/redis";
import { glob } from "glob";
import { LiveTestSuite } from "./liveTestHelpers";
import type { SpyInstance } from "vitest";

import * as stockTable from "../src/db/tables/stockTable";
import * as userTable from "../src/db/tables/userTable";
import * as watchlistTable from "../src/db/tables/watchlistTable";
import * as resourceRepository from "../src/redis/repositories/resourceRepository";
import * as sessionRepository from "../src/redis/repositories/sessionRepository";
import { SpyInstance } from "vitest";
import { listener } from "../src/server";
import { sentMessages } from "../src/signal/__mocks__/signalBase";
import * as signal from "../src/signal/signal";

import { LiveTestSuite } from "./liveTestHelpers";
import applyPostgresSeeds from "./seeds/postgres";
import applyRedisSeeds from "./seeds/redis";

vi.mock("../src/utils/logger");
vi.mock("../src/signal/signalBase");
vi.mock("@simplewebauthn/server", async () => await import("./moduleMocks/@simplewebauthn/server"));
Expand Down
4 changes: 2 additions & 2 deletions packages/backend/test/liveTestHelpers.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import initSupertest, { CallbackHandler, Test } from "supertest";
import { Stock, UNAUTHORIZED_ERROR_MESSAGE, stockListEndpointPath } from "@rating-tracker/commons";
import { TestFunction } from "vitest";
import initSupertest, { CallbackHandler, Test } from "supertest";
import type { TestFunction } from "vitest";

/**
* A supertest instance. Used to direct requests to the server running on the port specified in the test environment.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as SimpleWebAuthnServer from "@simplewebauthn/server";
import { randomUUID } from "crypto";

import * as SimpleWebAuthnServer from "@simplewebauthn/server";

const randomCredential = randomUUID();

export const { generateRegistrationOptions, generateAuthenticationOptions } =
Expand Down
1 change: 1 addition & 0 deletions packages/backend/test/seeds/postgres.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import {
Stock,
STOCK_UPDATE_MESSAGE,
} from "@rating-tracker/commons";

import client from "../../src/db/client";
import { addDynamicAttributesToStockData } from "../../src/models/dynamicStockAttributes";

Expand Down
2 changes: 1 addition & 1 deletion packages/backend/test/seeds/redis.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import redis from "../../src/redis/redis";
import { resourceRepository } from "../../src/redis/repositories/resourceRepository";
import { sessionRepository } from "../../src/redis/repositories/sessionRepository";
import redis from "../../src/redis/redis";

/**
* Writes example resource data into the resource repository in Redis. Must only be used in tests.
Expand Down

0 comments on commit d7e56f7

Please sign in to comment.