diff --git a/.env.test b/.env.test index 2b00db8..bbb6875 100644 --- a/.env.test +++ b/.env.test @@ -1,6 +1,9 @@ # Test Environment Configuration # This file is used during test execution +# Use in-memory SQLite for tests — avoids touching the seeded storage/players-sqlite3.db file +STORAGE_PATH=:memory: + # Disable rate limiting for most tests to avoid interference RATE_LIMIT_ENABLED=false diff --git a/.gitignore b/.gitignore index bb14270..00a130e 100644 --- a/.gitignore +++ b/.gitignore @@ -7,6 +7,6 @@ yarn-error.log* /prettier-debug.log .env *.js -src/data/players-sqlite3.db-shm -src/data/players-sqlite3.db-wal +players-sqlite3.db-shm +players-sqlite3.db-wal .claude/settings.local.json diff --git a/CHANGELOG.md b/CHANGELOG.md index b8f3eb0..d1357b7 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -46,8 +46,26 @@ This project uses football/soccer terminology for release names: ### Changed +- Tests switched to in-memory SQLite (`STORAGE_PATH=:memory:`) — seeded via `beforeAll`, production DB never touched during test runs + ### Deprecated +## [2.1.0-dribble] - 2026-03-30 + +### Added + +- 15 substitute players seeded in `storage/players-sqlite3.db` + +### Changed + +- Player dataset normalised to November 2022 World Cup snapshot: Enzo Fernández (SL Benfica / Liga Portugal), Mac Allister (Brighton & Hove Albion), Messi (Paris Saint-Germain / Ligue 1), Di María `abbrPosition` → `RW` +- Player UUIDs replaced with deterministic UUID v5 values (namespace `f201b13e-c670-473d-885d-e2be219f74c8`, formula `{firstName}-{lastName}`) +- Test fixtures renamed for clarity: `playerStub.nonexistent` (Lo Celso, squad 27 — not seeded, used for POST/DELETE) and `playerStub.existing` (Emiliano Martínez, squad 23 — always seeded, used for PUT) +- `playerStub.all` expanded to 26 players +- `PUT describe` in tests: removed `beforeEach`, added `afterEach` to restore Martínez; all tests retargeted to squad 23 +- `rest/players.rest` variables updated: `@newSquadNumber = 27`, `@existingSquadNumber = 23` +- Docker: run `docker compose down -v` before `docker compose up` to pick up the rebuilt seeded DB from `storage/players-sqlite3.db` (see #551) + ### Removed ### Fixed diff --git a/package.json b/package.json index d32cb21..82dcc93 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "ts-node-samples-express-restful", - "version": "1.0.0", + "version": "2.1.0-dribble", "description": "Proof of Concept for a RESTful API made with Node.js 24 (LTS/Krypton), Express.js 5 in TypeScript.", "type": "module", "main": "dist/server.js", diff --git a/rest/players.rest b/rest/players.rest index b263fad..488e390 100644 --- a/rest/players.rest +++ b/rest/players.rest @@ -2,8 +2,8 @@ # https://marketplace.visualstudio.com/items?itemName=humao.rest-client @baseUrl = http://localhost:9000 -@newSquadNumber = 5 -@existingSquadNumber = 5 +@newSquadNumber = 27 +@existingSquadNumber = 23 # ----------------------------------------------------------------------------- # GET /health @@ -48,15 +48,14 @@ POST {{baseUrl}}/players Content-Type: application/json { - "firstName": "Leandro", - "middleName": "Daniel", - "lastName": "Paredes", - "dateOfBirth": "1994-06-29T00:00:00.000Z", - "squadNumber": 5, - "position": "Defensive Midfield", - "abbrPosition": "DM", - "team": "AS Roma", - "league": "Serie A", + "firstName": "Giovani", + "lastName": "Lo Celso", + "dateOfBirth": "1996-04-09T00:00:00.000Z", + "squadNumber": 27, + "position": "Central Midfield", + "abbrPosition": "CM", + "team": "Villarreal CF", + "league": "La Liga", "starting11": false } @@ -154,16 +153,16 @@ PUT {{baseUrl}}/players/squadNumber/{{existingSquadNumber}} Content-Type: application/json { - "firstName": "Leandro", - "middleName": "Daniel", - "lastName": "Paredes", - "dateOfBirth": "1994-06-29T00:00:00.000Z", - "squadNumber": 5, - "position": "Defensive Midfield", - "abbrPosition": "DM", - "team": "AS Roma", - "league": "Serie A", - "starting11": false + "firstName": "Emiliano", + "middleName": null, + "lastName": "Martínez", + "dateOfBirth": "1992-09-02T00:00:00.000Z", + "squadNumber": 23, + "position": "Goalkeeper", + "abbrPosition": "GK", + "team": "Aston Villa FC", + "league": "Premier League", + "starting11": true } ### Request PUT /players/squadNumber/{squadNumber} nonexistent → Response status 404 Not Found @@ -250,7 +249,7 @@ Content-Type: application/json # ----------------------------------------------------------------------------- ### Request DELETE /players/squadNumber/{squadNumber} existing → Response status 204 No Content -DELETE {{baseUrl}}/players/squadNumber/{{existingSquadNumber}} +DELETE {{baseUrl}}/players/squadNumber/{{newSquadNumber}} ### Request DELETE /players/squadNumber/{squadNumber} nonexistent → Response status 404 Not Found DELETE {{baseUrl}}/players/squadNumber/99 diff --git a/storage/players-sqlite3.db b/storage/players-sqlite3.db index f48695c..b9ab581 100644 Binary files a/storage/players-sqlite3.db and b/storage/players-sqlite3.db differ diff --git a/tests/player-stub.ts b/tests/player-stub.ts index 6619b0d..0d04954 100644 --- a/tests/player-stub.ts +++ b/tests/player-stub.ts @@ -1,7 +1,7 @@ const playerStub = { all: [ { - id: 'ccffacd3-04bb-47fc-b296-3626cc9830e4', + id: '01772c59-43f0-5d85-b913-c78e4e281452', firstName: 'Damián', middleName: 'Emiliano', lastName: 'Martínez', @@ -14,7 +14,7 @@ const playerStub = { starting11: true, }, { - id: 'e2631558-c4a9-4bfe-a256-20c012e3058e', + id: 'da31293b-4c7e-5e0f-a168-469ee29ecbc4', firstName: 'Nahuel', middleName: null, lastName: 'Molina', @@ -27,7 +27,7 @@ const playerStub = { starting11: true, }, { - id: '15d270eb-f2f3-48b0-929c-4118bb83deab', + id: 'c096c69e-762b-5281-9290-bb9c167a24a0', firstName: 'Cristian', middleName: 'Gabriel', lastName: 'Romero', @@ -40,7 +40,7 @@ const playerStub = { starting11: true, }, { - id: 'e917c225-62ca-4104-ab11-97c285c1fab7', + id: 'd5f7dd7a-1dcb-5960-ba27-e34865b63358', firstName: 'Nicolás', middleName: 'Hernán Gonzalo', lastName: 'Otamendi', @@ -53,7 +53,7 @@ const playerStub = { starting11: true, }, { - id: '2a720525-5fa0-4ba3-91ca-29e57ef9f617', + id: '2f6f90a0-9b9d-5023-96d2-a2aaf03143a6', firstName: 'Nicolás', middleName: 'Alejandro', lastName: 'Tagliafico', @@ -66,20 +66,20 @@ const playerStub = { starting11: true, }, { - id: '35a047e2-8e66-4d0b-997e-655e044e0f4c', + id: 'b5b46e79-929e-5ed2-949d-0d167109c022', firstName: 'Ángel', middleName: 'Fabián', lastName: 'Di María', dateOfBirth: '1988-02-14T00:00:00.000Z', squadNumber: 11, position: 'Right Winger', - abbrPosition: 'LW', + abbrPosition: 'RW', team: 'SL Benfica', league: 'Liga Portugal', starting11: true, }, { - id: 'e459624c-c0bb-4109-a8f8-ced2d94211b7', + id: '0293b282-1da8-562e-998e-83849b417a42', firstName: 'Rodrigo', middleName: 'Javier', lastName: 'de Paul', @@ -92,7 +92,7 @@ const playerStub = { starting11: true, }, { - id: 'c8973352-48c1-4c48-b389-746ff9c3a157', + id: 'd3ba552a-dac3-588a-b961-1ea7224017fd', firstName: 'Enzo', middleName: 'Jeremías', lastName: 'Fernández', @@ -100,12 +100,12 @@ const playerStub = { squadNumber: 24, position: 'Central Midfield', abbrPosition: 'CM', - team: 'Chelsea FC', - league: 'Premier League', + team: 'SL Benfica', + league: 'Liga Portugal', starting11: true, }, { - id: '92ad0ed8-f7ac-4c69-93a1-fe5149b913ab', + id: '9613cae9-16ab-5b54-937e-3135123b9e0d', firstName: 'Alexis', middleName: null, lastName: 'Mac Allister', @@ -113,12 +113,12 @@ const playerStub = { squadNumber: 20, position: 'Central Midfield', abbrPosition: 'CM', - team: 'Liverpool FC', + team: 'Brighton & Hove Albion', league: 'Premier League', starting11: true, }, { - id: '4293d9c7-8561-42c3-9ec3-f04e6691ff76', + id: 'acc433bf-d505-51fe-831e-45eb44c4d43c', firstName: 'Lionel', middleName: 'Andrés', lastName: 'Messi', @@ -126,12 +126,12 @@ const playerStub = { squadNumber: 10, position: 'Right Winger', abbrPosition: 'RW', - team: 'Inter Miami CF', - league: 'Major League Soccer', + team: 'Paris Saint-Germain', + league: 'Ligue 1', starting11: true, }, { - id: 'b704a5ce-b08a-4ef9-bba4-fbab1e7a8e03', + id: '38bae91d-8519-55a2-b30a-b9fe38849bfb', firstName: 'Julián', middleName: null, lastName: 'Álvarez', @@ -143,19 +143,226 @@ const playerStub = { league: 'Premier League', starting11: true, }, + { + id: '5a9cd988-95e6-54c1-bc34-9aa08acca8d0', + firstName: 'Franco', + middleName: 'Daniel', + lastName: 'Armani', + dateOfBirth: '1986-10-16T00:00:00.000Z', + squadNumber: 1, + position: 'Goalkeeper', + abbrPosition: 'GK', + team: 'River Plate', + league: 'Copa de la Liga', + starting11: false, + }, + { + id: 'c62f2ac1-41e8-5d34-b073-2ba0913d0e31', + firstName: 'Gerónimo', + middleName: null, + lastName: 'Rulli', + dateOfBirth: '1992-05-20T00:00:00.000Z', + squadNumber: 12, + position: 'Goalkeeper', + abbrPosition: 'GK', + team: 'Villarreal CF', + league: 'La Liga', + starting11: false, + }, + { + id: '5fdb10e8-38c0-5084-9a3f-b369a960b9c2', + firstName: 'Juan', + middleName: 'Marcos', + lastName: 'Foyth', + dateOfBirth: '1998-01-12T00:00:00.000Z', + squadNumber: 2, + position: 'Right-Back', + abbrPosition: 'RB', + team: 'Villarreal CF', + league: 'La Liga', + starting11: false, + }, + { + id: 'bbd441f7-fcfb-5834-8468-2a9004b64c8c', + firstName: 'Gonzalo', + middleName: 'Ariel', + lastName: 'Montiel', + dateOfBirth: '1997-01-01T00:00:00.000Z', + squadNumber: 4, + position: 'Right-Back', + abbrPosition: 'RB', + team: 'Sevilla FC', + league: 'La Liga', + starting11: false, + }, + { + id: 'd8bfea25-f189-5d5e-b3a5-ed89329b9f7c', + firstName: 'Germán', + middleName: 'Alejo', + lastName: 'Pezzella', + dateOfBirth: '1991-06-27T00:00:00.000Z', + squadNumber: 6, + position: 'Centre-Back', + abbrPosition: 'CB', + team: 'Real Betis Balompié', + league: 'La Liga', + starting11: false, + }, + { + id: 'dca343a8-12e5-53d6-89a8-916b120a5ee4', + firstName: 'Marcos', + middleName: 'Javier', + lastName: 'Acuña', + dateOfBirth: '1991-10-28T00:00:00.000Z', + squadNumber: 8, + position: 'Left-Back', + abbrPosition: 'LB', + team: 'Sevilla FC', + league: 'La Liga', + starting11: false, + }, + { + id: '98306555-a466-5d18-804e-dc82175e697b', + firstName: 'Lisandro', + middleName: null, + lastName: 'Martínez', + dateOfBirth: '1998-01-18T00:00:00.000Z', + squadNumber: 25, + position: 'Centre-Back', + abbrPosition: 'CB', + team: 'Manchester United', + league: 'Premier League', + starting11: false, + }, + { + id: '9d140400-196f-55d8-86e1-e0b96a375c83', + firstName: 'Leandro', + middleName: 'Daniel', + lastName: 'Paredes', + dateOfBirth: '1994-06-29T00:00:00.000Z', + squadNumber: 5, + position: 'Defensive Midfield', + abbrPosition: 'DM', + team: 'AS Roma', + league: 'Serie A', + starting11: false, + }, + { + id: 'd3b0e8e8-2c34-531a-b608-b24fed0ef986', + firstName: 'Exequiel', + middleName: 'Alejandro', + lastName: 'Palacios', + dateOfBirth: '1998-10-05T00:00:00.000Z', + squadNumber: 14, + position: 'Central Midfield', + abbrPosition: 'CM', + team: 'Bayer 04 Leverkusen', + league: 'Bundesliga', + starting11: false, + }, + { + id: '7cc8d527-56a2-58bd-9528-2618fc139d30', + firstName: 'Alejandro', + middleName: 'Darío', + lastName: 'Gómez', + dateOfBirth: '1988-02-15T00:00:00.000Z', + squadNumber: 17, + position: 'Left Winger', + abbrPosition: 'LW', + team: 'Sevilla FC', + league: 'La Liga', + starting11: false, + }, + { + id: '191c82af-0c51-526a-b903-c3600b61b506', + firstName: 'Guido', + middleName: null, + lastName: 'Rodríguez', + dateOfBirth: '1994-04-12T00:00:00.000Z', + squadNumber: 18, + position: 'Defensive Midfield', + abbrPosition: 'DM', + team: 'Real Betis Balompié', + league: 'La Liga', + starting11: false, + }, + { + id: 'b1306b7b-a3a4-5f7c-90fd-dd5bdbed57ba', + firstName: 'Ángel', + middleName: 'Martín', + lastName: 'Correa', + dateOfBirth: '1995-03-09T00:00:00.000Z', + squadNumber: 15, + position: 'Right Winger', + abbrPosition: 'RW', + team: 'Atlético Madrid', + league: 'La Liga', + starting11: false, + }, + { + id: 'ecec27e8-487b-5622-b116-0855020477ed', + firstName: 'Thiago', + middleName: 'Ezequiel', + lastName: 'Almada', + dateOfBirth: '2001-04-26T00:00:00.000Z', + squadNumber: 16, + position: 'Attacking Midfield', + abbrPosition: 'AM', + team: 'Atlanta United FC', + league: 'Major League Soccer', + starting11: false, + }, + { + id: '7941cd7c-4df1-5952-97e8-1e7f5d08e8aa', + firstName: 'Paulo', + middleName: 'Exequiel', + lastName: 'Dybala', + dateOfBirth: '1993-11-15T00:00:00.000Z', + squadNumber: 21, + position: 'Second Striker', + abbrPosition: 'SS', + team: 'AS Roma', + league: 'Serie A', + starting11: false, + }, + { + id: '79c96f29-c59f-5f98-96b8-3a5946246624', + firstName: 'Lautaro', + middleName: 'Javier', + lastName: 'Martínez', + dateOfBirth: '1997-08-22T00:00:00.000Z', + squadNumber: 22, + position: 'Centre-Forward', + abbrPosition: 'CF', + team: 'Inter Milan', + league: 'Serie A', + starting11: false, + }, ], - new: { - firstName: 'Leandro', - middleName: 'Daniel', - lastName: 'Paredes', - dateOfBirth: '1994-06-29T00:00:00.000Z', - squadNumber: 5, - position: 'Defensive Midfield', - abbrPosition: 'DM', - team: 'AS Roma', - league: 'Serie A', + nonexistent: { + firstName: 'Giovani', + middleName: null, + lastName: 'Lo Celso', + dateOfBirth: '1996-04-09T00:00:00.000Z', + squadNumber: 27, + position: 'Central Midfield', + abbrPosition: 'CM', + team: 'Villarreal CF', + league: 'La Liga', starting11: false, }, + existing: { + firstName: 'Emiliano', + middleName: null, + lastName: 'Martínez', + dateOfBirth: '1992-09-02T00:00:00.000Z', + squadNumber: 23, + position: 'Goalkeeper', + abbrPosition: 'GK', + team: 'Aston Villa FC', + league: 'Premier League', + starting11: true, + }, findBySquadNumber(squadNumber: number): any | null { return this.all.find((player: { squadNumber: number }) => player.squadNumber === squadNumber) || null; }, diff --git a/tests/player-test.ts b/tests/player-test.ts index 4ce34fb..89a33a2 100644 --- a/tests/player-test.ts +++ b/tests/player-test.ts @@ -1,5 +1,7 @@ import request from 'supertest'; import app from '../src/app.js'; +import sequelize from '../src/database/sequelize.js'; +import PlayerModel from '../src/models/player-model.js'; import playerStub from './player-stub.js'; const path = '/players'; @@ -12,8 +14,13 @@ const hasFieldError = (errors: any[], fieldName: string): boolean => { }; describe('Integration Tests', () => { + beforeAll(async () => { + await sequelize.sync(); + await PlayerModel.bulkCreate(playerStub.all); + }); + afterEach(async () => { - const response = await request(app).delete(`${path}/squadNumber/${playerStub.new.squadNumber}`); + const response = await request(app).delete(`${path}/squadNumber/${playerStub.nonexistent.squadNumber}`); if (response.status !== 204 && response.status !== 404) { throw new Error(`Cleanup failed with status ${response.status}`); } @@ -131,13 +138,13 @@ describe('Integration Tests', () => { }); }); describe('POST', () => { - it('Request POST /players within rate limit → Response processed', async () => { + it('Request POST /players within rate limit → Response status 201 Created', async () => { // Arrange - const body = playerStub.new; + const body = playerStub.nonexistent; // Act const response = await request(app).post('/players').send(body); // Assert - expect([201, 409]).toContain(response.status); + expect(response.status).toBe(201); }); ((Number.parseInt(process.env.RATE_LIMIT_MAX_STRICT || '20', 10) >= 20) ? it.skip : it)('Request POST /players exceed rate limit → Response status 429 Too Many Requests', async () => { // This test is skipped by default as it requires making 20+ requests @@ -148,11 +155,11 @@ describe('Integration Tests', () => { for (let i = 0; i < maxRequests; i++) { await request(app) .post('/players') - .send(playerStub.new); + .send(playerStub.nonexistent); } // Assert - The next POST request should be rate limited - const response = await request(app).post('/players').send(playerStub.new); + const response = await request(app).post('/players').send(playerStub.nonexistent); expect(response.status).toBe(429); expect(response.body).toHaveProperty('error'); expect(response.body.error).toContain('Too many write requests'); @@ -244,7 +251,7 @@ describe('Integration Tests', () => { }); it('Request POST /players body existing → Response status 409 Conflict', async () => { // Arrange - const body = playerStub.findBySquadNumber(23); + const body = playerStub.existing; // Act const response = await request(app) .post(path) @@ -254,7 +261,7 @@ describe('Integration Tests', () => { }); it('Request POST /players body nonexistent → Response status 201 Created', async () => { // Arrange - const body = playerStub.new; + const body = playerStub.nonexistent; // Act const response = await request(app) .post(path) @@ -265,14 +272,19 @@ describe('Integration Tests', () => { }); }); describe('PUT', () => { - beforeEach(async () => { - await request(app).post(path).send(playerStub.new); + afterEach(async () => { + const response = await request(app) + .put(`${path}/squadNumber/${playerStub.existing.squadNumber}`) + .send(playerStub.findBySquadNumber(playerStub.existing.squadNumber)); // restores original seeded data + if (response.status !== 204) { + throw new Error(`Restore failed with status ${response.status}`); + } }); it('Request PUT /players/squadNumber/{squadNumber} within rate limit → Response status 204 No Content', async () => { // Arrange - const squadNumber = playerStub.new.squadNumber; - const body = playerStub.new; + const squadNumber = playerStub.existing.squadNumber; + const body = playerStub.existing; // Act const response = await request(app).put(`/players/squadNumber/${squadNumber}`).send(body); // Assert @@ -286,14 +298,14 @@ describe('Integration Tests', () => { // Act - Make PUT requests up to the strict limit for (let i = 0; i < maxRequests; i++) { await request(app) - .put(`/players/squadNumber/${playerStub.new.squadNumber}`) - .send(playerStub.new); + .put(`/players/squadNumber/${playerStub.existing.squadNumber}`) + .send(playerStub.existing); } // Assert - The next PUT request should be rate limited const response = await request(app) - .put(`/players/squadNumber/${playerStub.new.squadNumber}`) - .send(playerStub.new); + .put(`/players/squadNumber/${playerStub.existing.squadNumber}`) + .send(playerStub.existing); expect(response.status).toBe(429); expect(response.body).toHaveProperty('error'); expect(response.body.error).toContain('Too many write requests'); @@ -302,7 +314,7 @@ describe('Integration Tests', () => { describe('/players/squadNumber/:squadNumber', () => { it('Request PUT /players/squadNumber/{squadNumber} body empty → Response status 400 Bad Request', async () => { // Arrange - const squadNumber = playerStub.new.squadNumber; + const squadNumber = playerStub.existing.squadNumber; const body: Record = {}; // Act const response = await request(app) @@ -314,7 +326,7 @@ describe('Integration Tests', () => { }); it('Request PUT /players/squadNumber/{squadNumber} firstName missing → Response status 400 Bad Request', async () => { // Arrange - const squadNumber = playerStub.new.squadNumber; + const squadNumber = playerStub.existing.squadNumber; const body = { lastName: 'Doe', squadNumber, position: 'Forward' }; // Act const response = await request(app) @@ -327,7 +339,7 @@ describe('Integration Tests', () => { }); it('Request PUT /players/squadNumber/{squadNumber} lastName missing → Response status 400 Bad Request', async () => { // Arrange - const squadNumber = playerStub.new.squadNumber; + const squadNumber = playerStub.existing.squadNumber; const body = { firstName: 'John', squadNumber, position: 'Forward' }; // Act const response = await request(app) @@ -340,7 +352,7 @@ describe('Integration Tests', () => { }); it('Request PUT /players/squadNumber/{squadNumber} squadNumber missing → Response status 400 Bad Request', async () => { // Arrange - const squadNumber = playerStub.new.squadNumber; + const squadNumber = playerStub.existing.squadNumber; const body = { firstName: 'John', lastName: 'Doe', position: 'Forward' }; // Act const response = await request(app) @@ -353,7 +365,7 @@ describe('Integration Tests', () => { }); it('Request PUT /players/squadNumber/{squadNumber} position missing → Response status 400 Bad Request', async () => { // Arrange - const squadNumber = playerStub.new.squadNumber; + const squadNumber = playerStub.existing.squadNumber; const body = { firstName: 'John', lastName: 'Doe', squadNumber }; // Act const response = await request(app) @@ -366,7 +378,7 @@ describe('Integration Tests', () => { }); it('Request PUT /players/squadNumber/{squadNumber} squadNumber >99 → Response status 400 Bad Request', async () => { // Arrange - const squadNumber = playerStub.new.squadNumber; + const squadNumber = playerStub.existing.squadNumber; const body = { firstName: 'John', lastName: 'Doe', squadNumber: 100, position: 'Forward' }; // Act const response = await request(app) @@ -379,7 +391,7 @@ describe('Integration Tests', () => { }); it('Request PUT /players/squadNumber/{squadNumber} squadNumber <1 → Response status 400 Bad Request', async () => { // Arrange - const squadNumber = playerStub.new.squadNumber; + const squadNumber = playerStub.existing.squadNumber; const body = { firstName: 'John', lastName: 'Doe', squadNumber: 0, position: 'Forward' }; // Act const response = await request(app) @@ -403,8 +415,8 @@ describe('Integration Tests', () => { }); it('Request PUT /players/squadNumber/{squadNumber} existing → Response status 204 No Content', async () => { // Arrange - const squadNumber = playerStub.new.squadNumber; - const body = playerStub.new; + const squadNumber = playerStub.existing.squadNumber; + const body = playerStub.existing; // Act const response = await request(app) .put(`${path}/squadNumber/${squadNumber}`) @@ -416,7 +428,7 @@ describe('Integration Tests', () => { }); describe('DELETE', () => { beforeEach(async () => { - await request(app).post(path).send(playerStub.new); + await request(app).post(path).send(playerStub.nonexistent); }); // DELETE /players/squadNumber/:squadNumber ---------------------------- @@ -432,7 +444,7 @@ describe('Integration Tests', () => { }); it('Request DELETE /players/squadNumber/{squadNumber} existing → Response status 204 No Content', async () => { // Arrange - const squadNumber = playerStub.new.squadNumber; + const squadNumber = playerStub.nonexistent.squadNumber; // posted in beforeEach // Act const response = await request(app) .delete(`${path}/squadNumber/${squadNumber}`)