From 252c73d651226ce35234d3e47bb0e9b0fcfbf675 Mon Sep 17 00:00:00 2001 From: Steve Kinney Date: Sun, 29 Sep 2024 16:52:06 -0600 Subject: [PATCH] Remove person example --- examples/yearbook/package.json | 24 ------------------ examples/yearbook/person.js | 42 -------------------------------- examples/yearbook/person.test.js | 9 ------- 3 files changed, 75 deletions(-) delete mode 100644 examples/yearbook/package.json delete mode 100644 examples/yearbook/person.js delete mode 100644 examples/yearbook/person.test.js diff --git a/examples/yearbook/package.json b/examples/yearbook/package.json deleted file mode 100644 index dca4a4c..0000000 --- a/examples/yearbook/package.json +++ /dev/null @@ -1,24 +0,0 @@ -{ - "name": "yearbook", - "version": "1.0.0", - "main": "index.js", - "type": "module", - "scripts": { - "test": "vitest" - }, - "repository": { - "type": "git", - "url": "git+https://github.com/stevekinney/testing-javascript.git" - }, - "author": "Steve Kinney ", - "license": "MIT", - "bugs": { - "url": "https://github.com/stevekinney/testing-javascript/issues" - }, - "homepage": "https://github.com/stevekinney/testing-javascript#readme", - "devDependencies": { - "@vitest/ui": "^2.1.1", - "vite": "^5.4.5", - "vitest": "^2.1.1" - } -} diff --git a/examples/yearbook/person.js b/examples/yearbook/person.js deleted file mode 100644 index 68e66eb..0000000 --- a/examples/yearbook/person.js +++ /dev/null @@ -1,42 +0,0 @@ -/** - * A person in the yearbook. - * @class Person - * @param {number} id - * @param {string} firstName - * @param {string} lastName - * @param {string} dateOfBirth - */ -export class Person { - static id = 0; - - /** - * A person in the yearbook. - * @param {string} firstName - * @param {string} lastName - * @param {string} dateOfBirth - */ - constructor(firstName, lastName, dateOfBirth) { - this.id = ++Person.id; - this.firstName = firstName; - this.lastName = lastName; - this.dateOfBirth = dateOfBirth; - } - - get fullName() { - return `${this.firstName} ${this.lastName}`; - } - - get age() { - const today = new Date(); - const birthDate = new Date(this.dateOfBirth); - - let age = today.getFullYear() - birthDate.getFullYear(); - const month = today.getMonth() - birthDate.getMonth(); - - if (month < 0 || (month === 0 && today.getDate() < birthDate.getDate())) { - age--; - } - - return age; - } -} diff --git a/examples/yearbook/person.test.js b/examples/yearbook/person.test.js deleted file mode 100644 index 5f31485..0000000 --- a/examples/yearbook/person.test.js +++ /dev/null @@ -1,9 +0,0 @@ -import { describe, expect, it } from 'vitest'; -import { Person } from './person'; - -describe('Person', () => { - it('should be an instance of a Person', () => { - const person = new Person('John', 'Doe', '2000-01-01'); - expect(person).toBeInstanceOf(Person); - }); -});