Skip to content

Commit b02450a

Browse files
fix: fix adoption code test
1 parent 06df9a2 commit b02450a

File tree

3 files changed

+12
-11
lines changed

3 files changed

+12
-11
lines changed

docker-compose.yml

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,5 +18,3 @@ services:
1818
- MARIADB_ROOT_PASSWORD=root
1919
ports:
2020
- "3306:3306"
21-
volumes:
22-
- ./config/init.sql:/docker-entrypoint-initdb.d/init.sql

test/setup.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import chai from 'chai';
33
import nock from 'nock';
44
import path from 'node:path';
55
import { fileURLToPath } from 'node:url';
6+
import type { Knex } from 'knex';
67

78
import { populateMemList } from '../src/lib/geoip/whitelist.js';
89
import {
@@ -11,7 +12,6 @@ import {
1112
populateIpRangeList,
1213
populateNockCitiesList,
1314
} from './utils/populate-static-files.js';
14-
1515
import chaiOas from './plugins/oas/index.js';
1616
import { getRedisClient, initRedis } from '../src/lib/redis/client.js';
1717
import { client as sql } from '../src/lib/sql/client.js';
@@ -37,10 +37,10 @@ before(async () => {
3737
await populateNockCitiesList();
3838
});
3939

40-
const dropAllTables = async (sql) => {
40+
const dropAllTables = async (sql: Knex) => {
4141
const allTables = (await sql('information_schema.tables')
4242
.whereRaw(`table_schema = database()`)
4343
.select(`table_name as table`)
44-
).map(({ table }) => table);
44+
).map(({ table }: { table: string }) => table);
4545
await Bluebird.map(allTables, table => sql.schema.raw(`drop table \`${table}\``));
4646
};

test/tests/integration/adoption-code.test.ts

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,21 @@
1+
import type { Server } from 'node:http';
12
import nock from 'nock';
23
import { expect } from 'chai';
34
import * as sinon from 'sinon';
45
import type { Socket } from 'socket.io-client';
5-
import request from 'supertest';
6+
import request, { type SuperTest, type Test } from 'supertest';
67
import { getTestServer, addFakeProbe, deleteFakeProbe } from '../../utils/server.js';
78
import nockGeoIpProviders from '../../utils/nock-geo-ip.js';
89

9-
let probe: Socket;
10-
const app = await getTestServer();
11-
const requestAgent = request(app);
12-
const adoptionCodeStub = sinon.stub();
13-
1410
describe('Adoption code', () => {
11+
let app: Server;
12+
let requestAgent: SuperTest<Test>;
13+
let probe: Socket;
14+
const adoptionCodeStub = sinon.stub();
15+
1516
before(async () => {
17+
app = await getTestServer();
18+
requestAgent = request(app);
1619
nockGeoIpProviders();
1720

1821
probe = await addFakeProbe({

0 commit comments

Comments
 (0)