alternate data processing
This commit is contained in:
+3
-23
@@ -2,7 +2,6 @@ import { afterAll, beforeAll, describe, expect, test } from '@jest/globals'
|
||||
import clientMain from '../src/clientMain'
|
||||
import * as dotenv from 'dotenv'
|
||||
import db from '../src/db/db'
|
||||
import cache from '../src/cache/redis'
|
||||
dotenv.config()
|
||||
|
||||
let listenServer
|
||||
@@ -16,9 +15,9 @@ describe('client', () => {
|
||||
const request = await fetch("http://127.0.0.1:3000/servers")
|
||||
const data = await request.json()
|
||||
const first = Object.entries(data)[0]
|
||||
expect(first[1]).toHaveProperty('name')
|
||||
expect(first[1]).toHaveProperty('id')
|
||||
expect(first[1]).toHaveProperty('description')
|
||||
expect(first[1]).toHaveProperty('max_distance')
|
||||
expect(first[1]).toHaveProperty('total_distance')
|
||||
expect(first[1]).toHaveProperty('kills')
|
||||
})
|
||||
|
||||
test('player list', async () => {
|
||||
@@ -39,15 +38,6 @@ describe('client', () => {
|
||||
expect(first[1]).toHaveProperty('kills')
|
||||
})
|
||||
|
||||
test('player list with weapon and server filter', async () => {
|
||||
const request = await fetch("http://127.0.0.1:3000/players?weapons=sniper&server=1")
|
||||
const data = await request.json()
|
||||
const first = Object.entries(data)[0]
|
||||
expect(first[1]).toHaveProperty('max_distance')
|
||||
expect(first[1]).toHaveProperty('total_distance')
|
||||
expect(first[1]).toHaveProperty('kills')
|
||||
})
|
||||
|
||||
test('weapon list', async () => {
|
||||
const request = await fetch("http://127.0.0.1:3000/weapons")
|
||||
const data = await request.json()
|
||||
@@ -65,21 +55,11 @@ describe('client', () => {
|
||||
expect(first[1]).toHaveProperty('total_distance')
|
||||
expect(first[1]).toHaveProperty('kills')
|
||||
})
|
||||
|
||||
test('weapon list with player and server filter', async () => {
|
||||
const request = await fetch("http://127.0.0.1:3000/weapons?players=1005930844007&server=1")
|
||||
const data = await request.json()
|
||||
const first = Object.entries(data)[0]
|
||||
expect(first[1]).toHaveProperty('max_distance')
|
||||
expect(first[1]).toHaveProperty('total_distance')
|
||||
expect(first[1]).toHaveProperty('kills')
|
||||
})
|
||||
})
|
||||
|
||||
afterAll((done) => {
|
||||
listenServer.close(async () => {
|
||||
await db.destroy()
|
||||
await cache.quit()
|
||||
done()
|
||||
})
|
||||
})
|
||||
@@ -4,7 +4,6 @@ import serverMain from '../src/serverMain'
|
||||
import listenKills from "../src/process/onKill"
|
||||
import * as dotenv from 'dotenv'
|
||||
import db from '../src/db/db'
|
||||
import cache from '../src/cache/redis'
|
||||
dotenv.config()
|
||||
|
||||
let listenClient
|
||||
@@ -62,8 +61,8 @@ beforeAll(async () => {
|
||||
listenClient = await clientMain;
|
||||
listenServer = await serverMain;
|
||||
pgClient = await listenKills()
|
||||
const yea = waitFor(10000)
|
||||
const response = await fetch(`http://127.0.0.1:3001/${process.env.SERVERAUTH_ID}/kill`, {
|
||||
const yea = waitFor(1000)
|
||||
const response = await fetch(`http://127.0.0.1:3001/kill`, {
|
||||
method: "POST", // *GET, POST, PUT, DELETE, etc.
|
||||
credentials: "same-origin", // include, *same-origin, omit
|
||||
headers: {
|
||||
@@ -103,8 +102,8 @@ describe('realtime', () => {
|
||||
|
||||
test('update player', async () => {
|
||||
jest.setTimeout(15000)
|
||||
const yea = waitFor(10000)
|
||||
const response = await fetch(`http://127.0.0.1:3001/${process.env.SERVERAUTH_ID}/kill`, {
|
||||
const yea = waitFor(1000)
|
||||
const response = await fetch(`http://127.0.0.1:3001/kill`, {
|
||||
method: "POST", // *GET, POST, PUT, DELETE, etc.
|
||||
credentials: "same-origin", // include, *same-origin, omit
|
||||
headers: {
|
||||
@@ -138,7 +137,6 @@ afterAll((done) => {
|
||||
listenServer.close(async () => {
|
||||
await pgClient.end()
|
||||
await db.destroy()
|
||||
await cache.quit()
|
||||
done()
|
||||
})
|
||||
})
|
||||
|
||||
Reference in New Issue
Block a user