diff --git a/app.js b/app.js index dac2f97..70eeb5b 100644 --- a/app.js +++ b/app.js @@ -97,7 +97,6 @@ app.get('/asset/frontend.js', (req, res) => { }) app.get('/newSession', (req, res) => { - // XXX log.info(req.session) req.session.regenerate() log.info(req.session) diff --git a/app.test.js b/app.test.js index babd137..9e5e10b 100644 --- a/app.test.js +++ b/app.test.js @@ -26,4 +26,31 @@ describe('GET /getNextAnimal', () => { }) }) +describe('POST /recordButtonClick', () => { + const bodyData = JSON.stringify({ + animal: 'SlartyBartFast', + button: 'is critter', + session: 'dang', + difference: 1234, + time: new Date() + }) + it('should respond with 200 status', async () => { + const response = await request(app) + .post('/recordButtonClick') + .send(bodyData) + .set('Content-Type', 'application/json') + .set('Accept', 'application/json') + expect(response.statusCode).toBe(200) + // expect(response.body.message).toBe('Hello, World!'); + }) + it('have a result', async () => { + const response = await request(app) + .get('/results') + expect(response.statusCode).toBe(200) + //console.log(response.body) + expect(response.body.count.SlartyBartFast['is critter']).toBe(1) + expect(response.body.avgTimes.SlartyBartFast.total).toBe(1234) + }) +}) + // vim:set sts=2 sw=2 et: diff --git a/index.html b/index.html index 61a89df..e6875d1 100644 --- a/index.html +++ b/index.html @@ -1,47 +1,50 @@ - - + + Is this a Critter? - - -
-

Is this a Critter?

-

what about?:

- - -
+ + +
+

Is this a Critter?

+

what about?:

+ + +
-
-

- -

-
+
+

+ +

+
- - - - + + + + - diff --git a/package.json b/package.json index 80abd8d..99f66a6 100644 --- a/package.json +++ b/package.json @@ -6,6 +6,7 @@ "scripts": { "test": "./node_modules/.bin/jest", "lint": "./node_modules/.bin/standard --ignore *.test.js .", + "fix": "./node_modules/.bin/standard --ignore *.test.js --fix .", "start": "node server.js", "act": "act -W ./.gitea/workflows/" },