5.0.1 • Published 4 years ago

static-mock-data v5.0.1

Weekly downloads
4
License
(MIT OR CC-BY-NC-...
Repository
github
Last release
4 years ago

Static mock data

Static mock data (as opposed to randomly-generated mock data) for sample apps, demos, and POCs.

Build Status Coverage Status

npm Dependencies License

OS and Browser Compatibility

Features

  • 100 mock employees, with names, addresses, phone numbers, etc.
  • 100 mock projects, with names, dates, departments, employees assigned, etc.
  • Full-size and thumbnail photos for each employee
  • No dependencies
  • Tested in Node.js and all modern web browsers on Mac, Windows, and Linux
  • All data follows logical rules:
    • Usernames, SSNs, addresses, etc. are unique
    • Birthdates, hire dates, and termination dates are in proper chronological order
    • Employee roles "make sense" (e.g. "full time" and "part time" are mutually exclusive)
    • Employees are only assigned to projects in their own department
    • Employees are only assigned to projects that occurred during their employment

Installation

Install using NPM or Yarn:

npm install @jsdevtools/static-mock-data

Usage

The mock data can be used as plain JSON or as JavaScript objects.

Raw JSON

const employees = require("@jsdevtools/static-mock-data/employees.json");

for (let employee of employees) {
  console.log(employee.dob);        // date string
  console.log(employee.portrait);   // relative file path
}

JavaScript Objects

const mockData = require("@jsdevtools/static-mock-data");

for (let employee of mockData.employees) {
  console.log(employee.dob);        // Date object
  console.log(employee.portrait);   // absolute file path
}

Browser support

Static Mock Data supports recent versions of every major web browser. Older browsers may require Babel and/or polyfills.

To use Static Mock Data in a browser, you'll need to use a bundling tool such as Webpack, Rollup, Parcel, or Browserify. Some bundlers may require a bit of configuration, such as setting browser: true in rollup-plugin-resolve.

Employees

mockData.employees is an array of objects with the following properties:

PropertyData TypeDescription
usernamestringA alphanumeric username that is unique for each employee
passwordstringAn alphanumeric password
name.firststringFirst name
name.laststringLast name
genderstring"male" or "female"
portraitstringThe path of the full-size portrait photo
thumbnailstringThe path of the thumbnail-size portrait photo
emailstringEmail address
address.streetstringHouse number and street name
address.citystringCity name
address.statestringU.S. state name (full name, not abbreviation)
address.zipstringU.S. zip code, in the format #####
phonesarray of objectsArray of phone objects
phones[].typestring"home", "office", or "cell"
phones[].numberstringPhone number, in the format ###-##-####
ssnstringU.S. Social Security Number, in the format ###-##-####. Unique for each employee.
dobDateDate of birth
hiredOnDateDate the employee was hired
terminatedOnDate or nullDate the employee was terminated, or null if still employed
departmentstring"Accounting", "Sales", "Human Resources", or "Marketing"
rolesarray of stringsArray of roles, such as "employee", "consultant", "part time", etc.

Projects

mockData.projects is an array of objects with the following properties:

PropertyData TypeDescription
idnumberNumeric ID that is unique for each project
namestringProject name that is unique for each project. 55 characters max.
descriptionstringLong project description. 2000 characters max
departmentstring"Accounting", "Sales", "Human Resources", or "Marketing"
startedOnDateDate that the project started
endedOnDate or nullDate that the project ended, or null if still ongoing
assignedarray of stringsArray of usernames of employees who are assigned to the project. Projects will only have employees from the same department.

Contributing

Contributions, enhancements, and bug-fixes are welcome! Open an issue on GitHub and submit a pull request.

Building

To build the project locally on your computer:

  1. Clone this repo git clone https://github.com/JS-DevTools/static-mock-data.git

  2. Install dependencies npm install

  3. Run the build script npm run build

  4. Run the tests npm test

License

All JSON data is MIT licensed and can be used however you want.

All images (employee portraits) are licensed under Creative Commons BY-NC-SA 4.0 and have some limitations on their use.

See the LICENSE file for more details.

Big Thanks To

Thanks to these awesome companies for their support of Open Source developers ❤

Travis CI SauceLabs Coveralls

5.0.1

4 years ago

5.0.0

4 years ago

4.0.2

5 years ago

4.0.1

5 years ago

4.0.0

5 years ago

3.2.14

5 years ago

3.2.12

6 years ago

3.2.11

6 years ago

3.2.10

6 years ago

3.2.9

6 years ago

3.2.8

6 years ago

3.2.7

7 years ago

3.2.6

7 years ago

3.2.5

7 years ago

3.2.4

7 years ago

3.2.3

7 years ago

3.2.2

7 years ago

3.2.1

7 years ago

3.2.0

7 years ago

3.1.1

8 years ago

3.1.0

8 years ago