From fac51f12faea11d44173a6e072aa80e70046681a Mon Sep 17 00:00:00 2001 From: Raymonzut <40148684+Raymonzut@users.noreply.github.com> Date: Sat, 28 Mar 2020 22:06:30 +0000 Subject: [PATCH 1/3] Add tested me.js for age --- src/me.js | 21 +++++++++++++++++++++ test/me.js | 10 ++++++++++ 2 files changed, 31 insertions(+) create mode 100755 src/me.js create mode 100755 test/me.js diff --git a/src/me.js b/src/me.js new file mode 100755 index 0000000..3c59fe6 --- /dev/null +++ b/src/me.js @@ -0,0 +1,21 @@ +module.exports = { + age: age, +}; + +function age() { + let birthdate = new Date(2002, 8, 29); + let now = new Date(); + + let age = now.getFullYear() - birthdate.getFullYear(); + + if (now.getMonth() < birthdate.getMonth()) { + age--; + } + if ( + birthdate.getMonth() === now.getMonth() && + now.getDate() < birthdate.getDate() + ) { + age--; + } + return age; +} diff --git a/test/me.js b/test/me.js new file mode 100755 index 0000000..9a6358d --- /dev/null +++ b/test/me.js @@ -0,0 +1,10 @@ +const assert = require("chai").assert; +const me = require("../src/me"); + +describe("me", () => { + describe("age", () => { + it("should return a positive number", () => { + assert.isAbove(me.age(), 0); + }); + }); +}); From a0edd4d64e737542665324a1f8ef12d219ae80bd Mon Sep 17 00:00:00 2001 From: Raymonzut <40148684+Raymonzut@users.noreply.github.com> Date: Sat, 28 Mar 2020 22:08:14 +0000 Subject: [PATCH 2/3] Add aboutme component with age --- src/components/aboutme.vue | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) create mode 100755 src/components/aboutme.vue diff --git a/src/components/aboutme.vue b/src/components/aboutme.vue new file mode 100755 index 0000000..e27b6e3 --- /dev/null +++ b/src/components/aboutme.vue @@ -0,0 +1,16 @@ + + + From ff5f3bcf9c7e056e4e40092fc8d90dba86fd06c9 Mon Sep 17 00:00:00 2001 From: Raymonzut <40148684+Raymonzut@users.noreply.github.com> Date: Sun, 29 Mar 2020 20:19:22 +0200 Subject: [PATCH 3/3] Elaborate about myself --- src/components/aboutme.vue | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/src/components/aboutme.vue b/src/components/aboutme.vue index e27b6e3..2d42e3d 100755 --- a/src/components/aboutme.vue +++ b/src/components/aboutme.vue @@ -1,6 +1,14 @@ @@ -14,3 +22,11 @@ export default { } } + +