QAP 1 - Password Generator

QAP 1 - Password Generator

Objective

Create a Command-Line Interface (CLI) application in Node.js that generates passwords for users based on arguments they provide via flags.
Due Date: May 15th, 2025, at 11:59 PM

Getting Started

To help you get started, a base repository has been provided for you to work from. The repository is set up as a GitHub Assignment to help you quickly get started.

Steps to Create Your Own Repository

  1. Click the link above and select your name on the list that appears, if you haven’t already.

  2. Click the “Accept this assignment” button.

  3. Once your repository is created, clone your new repo to your local machine:

    git clone <your-new-repo-url>
  4. Navigate into the project directory and install the necessary dependencies:

    cd <your-new-repo-name>
    npm install
  5. Run the app from the command line:

    node passwordGenerator.js [flags]

    Replace [flags] with any supported flags like --length, --numbers, etc.

  6. Run tests:

    npm test

    This will run the unit tests for the application.

By using this template, you’ll have the project structure and initial setup ready to go so you can focus on building the functionality.

Note: This code has been provided as a starting point for you to work from. It is by no means a completed QAP.

Requirements

Functionality

  • Basic Features:
    • Support the following command-line flags:
      • --help: displays a help message explaining how to use the application and its flags. This flag is required to be implemented.
      • --length <number>: specifies the length of the password.
      • --lowercase: include lowercase letters in the password.
      • --numbers: include numbers in the password.
    • If no --length flag is provided, default the password length to 8.
    • If neither --lowercase nor --numbers is provided, default to including lowercase letters.
    • If no character types are selected (for example, if --lowercase is explicitly disabled and --numbers is not provided), the program should throw an error.
    • The application should handle invalid input gracefully, displaying an informative error message rather than crashing.

Testing

  • Write a complete set of unit tests for the generatePassword function.
  • Tests must be developed on a separate branch and merged into the main branch using a GitHub pull request.
  • Tests must cover different input scenarios and verify that the function behaves as expected.
  • All tests must pass before submission.

Code Quality

  • Maintain clear and consistent code style.
  • Ensure proper error handling.

Git Hygiene

  • Regularly commit changes with meaningful messages.
  • Do not commit unnecessary files such as node_modules or temporary files.

Extra Files

  • Your project must include:
    • README.md explaining:
      • The purpose of the application.
      • How to use it.
      • How to run the tests.

Submission Guidelines

  • Ensure all code runs correctly and meets the requirements.
  • Submissions should be made on Teams under the appropriate assignment.
  • Submissions should only include a link to your GitHub repository containing the completed code for your QAP.
  • Submissions are subject to the Keyin late assessment policy found here
  • If an extension is required, please contact me directly before the due date.

Grading Rubric

CategoryCriteriaPoints
Functionality45
    Help FlagImplements --help flag that displays usage instructions.5
    Password Length FlagAllows user to specify password length and applies it correctly.10
    Default Length BehaviorDefaults to 8 when no length is provided.5
    Default Character BehaviorDefaults to lowercase when no character flags are provided.5
    Invalid Input HandlingHandles invalid input with clear error messages.5
    Character FlagsCorrectly implements --lowercase and --numbers flags.15
Testing20
    Test CoverageAdequate tests written for generatePassword covering different scenarios.15
    All Tests PassingAll tests pass successfully.5
Git Hygiene15
    Branching and Pull RequestTests developed on a separate branch and merged via pull request.5
    Commit Frequency and QualityRegular commits with descriptive messages.5
    No Unnecessary FilesNo unnecessary files (e.g., node_modules) committed.5
Code Quality10
    Readability and StructureCode is well-organized, follows a clear structure, and uses appropriate style.10
Project Structure5
    README.mdIncludes clear description, usage instructions, and test instructions.5
Total Points100

Good luck! If you have any questions, please don’t hesitiate to ask!