This package has been deprecated

    Author message:

    bakker has been move to @drieam/api

    @drieam/bakker
    TypeScript icon, indicating that this package has built-in type declarations

    4.11.1 • Public • Published

    npm

    @drieam/bakker

    Bakker [ˈbakər] is a test library that generates models with randon data for Eduframe or Canvas

    Table of Contents

    Getting Started

    Installation

    Install the @drieam/bakker and its dependencies.

    yarn add @drieam/bakker

    Usage

    import * as bakker from '@drieam/bakker';
     
    const user = bakker.user();
    const arrayUsers = bakker.user.array(10);
    const userPeter = bakker.user({
      name: 'Peter'
    });

    API

    Bakker.bake()

    Bakker contains a generator to create new fakes base on your own custom models.

    import * as faker from 'faker';
    import models from '@drieam/models';
    import bakker from '@drieam/bakker';
     
    class Baker extents models.User {
      public favouriteBread;
    }
     
    const baker = bakker.user({ favouriteBread: 'toasts' }, Baker);
    const mybaker = baker();
    // { favouriteBread: 'toasts', .... }

    Or you can create your own constructor.

    import * as faker from 'faker';
    import models from '@drieam/models';
    import bakker from '@drieam/bakker';
     
    class Baker extents models.User {
      public favouriteBread;
    }
     
    function defaultData() {
      return {
        favouriteBread: faker.random.arrayElement(['bread', 'appleflap', 'worstebroodje']);
      }
    }
     
    const baker = bakker.baker(defaultData, Baker);
    const mybaker = baker();
    // { favouriteBread: 'toasts', .... }

    Contributing

    We welcome all contributors who abide by our Code of Conduct. Please see the Contributors Guide for more details on submitting a PR, setting up a local dev environment, running tests, etc...

    Versioning

    Until this project reaches a 1.0 milestone, minor version numbers will simply be incremented during each release. The Changelog will continue to document the different types of updates, including any "breaking changes".

    After the 1.0 milestone, this project will follow SemVer.

    Keywords

    none

    Install

    npm i @drieam/bakker

    DownloadsWeekly Downloads

    63

    Version

    4.11.1

    License

    MIT

    Unpacked Size

    202 kB

    Total Files

    52

    Last publish

    Collaborators

    • martijnpieters
    • ellya
    • drieambot
    • stef.schenkelaars
    • hbarrientosg