ziyi01 / Inkposter

Project for course DH2643 at KTH.
Apache License 2.0
1 stars 0 forks source link

Host session end and some styling #32

Closed ziyi01 closed 2 days ago

ziyi01 commented 2 days ago

Merging the frontend into main so @JuliaHallberg's changes are available

github-actions[bot] commented 2 days ago

Coverage report

[!CAUTION] Test run failed

St.:grey_question:
Category Percentage Covered / Total
🟑 Statements 66.67% 46/69
πŸ”΄ Branches 33.33% 6/18
πŸ”΄ Functions 42.86% 9/21
🟑 Lines 66.67% 46/69

Test suite run failed

Failed tests: 4/7. Failed suites: 2/3.
``` ● Connection and db test β€Ί Create and delete user MongoServerError: E11000 duplicate key error collection: dh2643_inkposter.users index: _id_ dup key: { _id: "100" } 42 | } catch (err) { 43 | debug("An error occured: ", err); > 44 | throw new Error(err); | ^ 45 | } 46 | 47 | at Object.createUser (db.js:44:11) at Object. (__test__/db.test.js:10:9) ● Connection and db test β€Ί Retrieve user expect(received).toEqual(expected) // deep equality - Expected - 2 + Received + 9 Object { "_id": "0", - "avatar": "rat.png", - "username": "rat", + "avatar": "better_rat.png", + "previousThemes": Array [ + "rat", + "rat", + "rat", + "rat", + "rat", + ], + "username": "rat1", } 18 | test("Retrieve user", async () => { 19 | const user = await db.getUser("0"); > 20 | expect(user).toEqual({ _id: "0", username: 'rat', avatar: 'rat.png' }); | ^ 21 | }); 22 | 23 | test("Retrieve user stats", async () => { at Object.toEqual (__test__/db.test.js:20:22) ● Connection and db test β€Ί Retrieve user stats expect(received).toEqual(expected) // deep equality - Expected - 4 + Received + 10 Object { "_id": "0", - "gallery": Array [], + "gallery": Array [ + "new_drawing", + "new_drawing", + "new_drawing", + "new_drawing", + "new_drawing", + ], "inkposter": Object { - "losses": 0, - "wins": 0, + "losses": 7, + "wins": 4, }, "innocent": Object { "losses": 0, - "wins": 0, + "wins": 4, }, } 23 | test("Retrieve user stats", async () => { 24 | const stats = await db.getUserStats("0"); > 25 | expect(stats).toEqual({ _id: "0", innocent: {wins : 0, losses: 0}, inkposter: {wins : 0, losses: 0}, gallery: [] }); | ^ 26 | }); 27 | 28 | test("Update username", async () => { at Object.toEqual (__test__/db.test.js:25:23) ● Connection and db test β€Ί Update username expect(received).toEqual(expected) // deep equality - Expected - 1 + Received + 8 Object { "_id": "0", - "avatar": "rat.png", + "avatar": "better_rat.png", + "previousThemes": Array [ + "rat", + "rat", + "rat", + "rat", + "rat", + ], "username": "rat1", } 30 | expect(response.acknowledged).toBe(true); 31 | const user = await db.getUser("0"); > 32 | expect(user).toEqual({ _id: "0", username: 'rat1', avatar: 'rat.png' }); | ^ 33 | await db.updateUsername("0", "rat"); 34 | }); 35 | at Object.toEqual (__test__/db.test.js:32:22) ``` --- ``` ● Test suite failed to run The OPENAI_API_KEY environment variable is missing or empty; either provide it, or instantiate the OpenAI client with an apiKey option, like new OpenAI({ apiKey: 'My API Key' }). 1 | var debug = require('debug')('server:openai'); 2 | var OpenAI = require('openai'); > 3 | const openai = new OpenAI({ apiKey: process.env.OPENAI_API_KEY }); | ^ 4 | 5 | async function generateSessionParams(previousThemes="", fakeThemeCount=3, playerCount=8) { 6 | try { at new OpenAI (node_modules/openai/src/index.ts:123:13) at Object. (openai.js:3:16) at Object.require (routes/api.js:4:14) at Object.require (app.js:10:17) at Object.require (__test__/route.test.js:4:13) ```

Report generated by πŸ§ͺjest coverage report action from 85ae738effe70a87d0fa13b7c9122c6b7705bb3b