Skip to content

Latest commit

 

History

History
69 lines (45 loc) · 1.76 KB

README.md

File metadata and controls

69 lines (45 loc) · 1.76 KB

fortepiano [ˌfɔrteˈpjaːno]

Playing actual music over fp-ts notes 🎶

GitHub Workflow Status Codecov GitHub npm

Description

Fortepiano is a mocking library for TypeScript. It promotes immutability, composability and purity, making it ideal for projects that embrace functional programming principles.

Getting Started

Installation

To install the stable version:

npm install fortepiano

or using yarn:

yarn add fortepiano

Usage

Fortepiano uses a functional API to create and configure mocks, encouraging pure function usage and immutable mock objects.

Here's an example:

import { $mock } from 'fortepiano'

interface User {
  firstName: string
  lastName: string
}

export const UserMock = (): $mock.Mock<User> =>
  $mock.struct({
    firstName: $mock.string,
    lastName: $mock.string,
  })

console.log(UserMock()()()) // Output: { firstName: 'randomString', lastName: 'randomString' }

Contributing

See the CONTRIBUTING.md file for details.

Authors

License

This project is licensed under the MIT License. See the LICENSE.md file for details.