GitHub Repository: https://github.com/atmason90/team-profile-generator
The purposed of this project was to create a command line application that allows a user to generate a team profile by answering a set of prompts presented to them inside the terminal.
This application uses node.js and the npm inquirer package as it's core technologies. Jest was used for unit testing to ensure that the app would function properly.
team-profile-generator.mp4
In order to use this application, follow these steps:
- Clone this repository to your local machine
- Open the repository in your code editor of choice
- Navigate to the repository in your terminal and run
bash npm install
, which will install Inquirer and Jest - In your terminal, run
bash node index.js
to initialize the application - Answer all provided prompts
- Once complete - navigate to the "dist" directory to find your myteam.html file
This is an example shows part of an async function I used to continue prompting the user depending on their answers.
async function assembleTeam() {
const promise = new Promise((resolve, reject) => {
employeePrompt()
.then(function({ name, id, email, role }) {
if(role === "Manager") {
managerPrompt().then(function({ officeNumber }) {
this.employee = new Manager(name, id, email, officeNumber, role);
teamArray.push(employee);
addEmployee()
.then(({ addEmployee }) => {
if(addEmployee === true) {
assembleTeam();
} else {
resolve("complete")
}
})
});
} else if (role === "Engineer") {
engineerPrompt().then(function({ github }) {
this.employee = new Engineer(name, id, email, github, role);
teamArray.push(employee);
addEmployee()
.then(({ addEmployee }) => {
if(addEmployee === true) {
assembleTeam();
} else {
resolve("complete");
}
})
});
} else if (role === "Intern") {
internPrompt().then(function({ school }) {
this.employee = new Intern(name, id, email, school, role);
teamArray.push(employee);
addEmployee()
.then(({ addEmployee }) => {
if(addEmployee === true) {
assembleTeam();
} else {
resolve("complete")
}
})
});
}
This example shows how I structured my Jest tests.
const { test, expect } = require("@jest/globals");
const Employee = require("../lib/employee");
test("create employee instance", () => {
const newEmployee = new Employee();
expect(typeof(newEmployee)).toBe("object");
});
If you have any questions regarding this project, please reach out to me via email at atmason90@gmail.com.
You can view my other projects on GitHub by visiting my profile. atmason90
MIT License
Copyright (c) 2022 Andrew Mason
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.