From ae979c57f1736edb1dbe74909a88054eb7baf001 Mon Sep 17 00:00:00 2001 From: Yuriy Maksymets <iurii.maksymets@gmail.com> Date: Sat, 23 Nov 2019 12:59:07 +0000 Subject: [PATCH] Fixed format --- __tests__/shape.test.js | 35 +++++++++++++++++++++++++++++------ public/index.html | 18 ++++++++---------- src/app.js | 5 ++++- 3 files changed, 41 insertions(+), 17 deletions(-) diff --git a/__tests__/shape.test.js b/__tests__/shape.test.js index bca2693..1f2b315 100644 --- a/__tests__/shape.test.js +++ b/__tests__/shape.test.js @@ -11,7 +11,10 @@ describe("shape recognition", () => { describe("lines", () => { test("should recognize a simple horizontal line", () => { - const points = [[0, 0], [100, 0]] + const points = [ + [0, 0], + [100, 0], + ] const result = recognizeFromPoints(points) expect(result.shape).toBe(Shapes.line) expect(result.firstPoint).toStrictEqual([0, 0]) @@ -19,7 +22,10 @@ describe("shape recognition", () => { }) test("should recognize a simple vertical line", () => { - const points = [[0, 50], [0, -100]] + const points = [ + [0, 50], + [0, -100], + ] const result = recognizeFromPoints(points) expect(result.shape).toBe(Shapes.line) expect(result.firstPoint).toStrictEqual([0, 50]) @@ -27,13 +33,21 @@ describe("shape recognition", () => { }) test("should recognize a slightly curve horizontal line", () => { - const points = [[0, 0], [30, 5], [100, 0]] + const points = [ + [0, 0], + [30, 5], + [100, 0], + ] const result = recognizeFromPoints(points) expect(result.shape).toBe(Shapes.line) }) test("should not recognize a heavily curved horizontal line", () => { - const points = [[0, 0], [30, 30], [100, -4]] + const points = [ + [0, 0], + [30, 30], + [100, -4], + ] const result = recognizeFromPoints(points) expect(result.shape).not.toBe(Shapes.line) }) @@ -339,13 +353,22 @@ describe("shape recognition", () => { }) test("should not recognize rectangle with non-rectangular points", () => { - const points = [[5, 1], [23, 0], [10, 54], [0, 10]] + const points = [ + [5, 1], + [23, 0], + [10, 54], + [0, 10], + ] const result = recognizeFromPoints(points) expect(result.shape).not.toBe(Shapes.rectangle) }) test("should not recognize unclosed rectangle", () => { - const points = [[-10, -10], [10, -10], [10, 10]] + const points = [ + [-10, -10], + [10, -10], + [10, 10], + ] const result = recognizeFromPoints(points) expect(result.shape).not.toBe(Shapes.rectangle) }) diff --git a/public/index.html b/public/index.html index 0607134..bb59041 100644 --- a/public/index.html +++ b/public/index.html @@ -13,16 +13,14 @@ /> <script> if (navigator.serviceWorker) { - navigator.serviceWorker - .register("service-worker.js") - .then( - (registration) => - console.log( - `Service worker registered on scope ${registration.scope}`, - ), - (reason) => - console.log(`Service worker failed to register ~ ${reason}`), - ) + navigator.serviceWorker.register("service-worker.js").then( + (registration) => + console.log( + `Service worker registered on scope ${registration.scope}`, + ), + (reason) => + console.log(`Service worker failed to register ~ ${reason}`), + ) } </script> </head> diff --git a/src/app.js b/src/app.js index 876ed05..97ff48f 100644 --- a/src/app.js +++ b/src/app.js @@ -210,7 +210,10 @@ function drawRecognizedUpcoming(points) { function drawRecognized(pathID, points) { drawIfRecognized(points, (newPoints) => - room.replacePath(pathID, newPoints.map((x) => attributedPoint(...x))), + room.replacePath( + pathID, + newPoints.map((x) => attributedPoint(...x)), + ), ) clearRecognizedUpcoming() } -- GitLab