Coder Social home page Coder Social logo

lab-json-and-persisting-data's Introduction

JSON and Persisting Data

You will build an app that generates a fake data set for a new app with the npm package faker-js@7.

Getting Started

  1. Fork and clone this repository.
  2. Navigate to the cloned repository's directory on your command line.
  3. Turn this project into a Node.js project by running npm init -y.
  4. Create a .gitignore and add the appropriate files and folders
  5. Open up the repository in VSCode.
  6. Create an index.js file.
  7. Add faker-js@7 and jest@29 to dev dependencies.

Instructions

To complete this lab, follow the instructions below. Additionally, make sure you are organizing your code and limiting the amount of things your functions do.

You can choose whatever app idea you want and whatever data set makes sense for your app. At a minimum, your data set should have randomly generated fields for at least one of the following:

  • Unique id
  • String
  • Boolean
  • Number

For example, if you chose to make a forum for hackers, you could use the following:

  • id: A unique id

  • hackerName: faker adjective + chemicalElement + animal ( e.g.Hyper Hydrogen Hyena)

  • messageTitle: Help with hacker.adjective + hacker.abbreviation on git.branch.

  • messageContent: lorem.paragraph.

  • isResolved: A boolean for whether or not the issue is resolved.

  • messageResponse : hacker.phrase. -date: the message was posted.

  • numberOfUpvotes: the number of upvotes

  • Through the command line, a user should be able to choose whether to create one or many randomly generated messages.

  • The messages should be read from a JSON file.

  • Additional messages should be able to be added to the JSON file.

Then, add Jest and write at least two tests. Since you are generating random data, what can you test, and how can you test it?

You could:

  • Confirm all the correct fields exist when creating a new item.
  • Make sure the correct datatype is being inserted into each field.
  • Confirm that the function to create one item creates only one item.
  • Confirm that the function to create many items creates the correct number of items.

You should not:

  • Write tests that are dependent on changing the data in the data.json file

lab-json-and-persisting-data's People

Contributors

krafalski avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.