add player registration to tests

This commit is contained in:
2023-09-07 17:10:05 +02:00
parent b3291a65ae
commit 91283c8c7c
+30 -4
View File
@@ -104,12 +104,28 @@ const testMatchStats: MatchCloseData = {
air: 1220.2, air: 1220.2,
ground: 500.4, ground: 500.4,
wall: 200.1 wall: 200.1
},
data: {
username: 'Legonzaur'
} }
}, },
weapons: {} weapons: {
mp_testweapon: {
playtime: 1569.1,
shotsCrit: 15,
shotsFired: 5,
shotsHeadshot: 9,
shotsHit: 4,
shotsRichochet: 0
}
},
titans: {
testTitan: {
playtime: 1569.1,
shotsCrit: 15,
shotsFired: 5,
shotsHeadshot: 9,
shotsHit: 4,
shotsRichochet: 0
}
}
} }
} }
@@ -179,6 +195,16 @@ describe('stats', () => {
expect(response.status).toBe(201) expect(response.status).toBe(201)
}) })
test('register a player', async () => {
const response = await fetch(`http://127.0.0.1:3001/player/${testKill.attacker.id}/connect`, {
method: 'POST',
headers,
body: JSON.stringify({ username: 'Legonzaur', match_id: testKill.match_id })
})
console.log(await response.text())
expect(response.status).toBe(200)
})
test('register a kill', async () => { test('register a kill', async () => {
const response = await fetch('http://127.0.0.1:3001/kill', { const response = await fetch('http://127.0.0.1:3001/kill', {
method: 'POST', method: 'POST',