GithubHelp home page GithubHelp logo

charlies-factory's People

Contributors

dependabot-preview[bot] avatar isthatcentered avatar

Stargazers

 avatar  avatar

Watchers

 avatar  avatar  avatar

charlies-factory's Issues

Pass iteration index to pack() function

GEMS = pack( 2, () => makeGem( faker => ({
    id: faker.random.uuid(),
}) ) )

Here, having the ability to use the index as id instead of a faker function would be nice

Make types more explicit

Currently, the type suggestion shows
image

That's not very useful. As a user, I want to know clearly what type of primitive I can pass to the function.

Pass a per factory made index number

Not sure about that one, specially mixed with faker & the iterator passed to pack().

Here's what it would look like:

test( `Each generated item has it's own per factory "made" ID`, () => {
    const makeThing      = factory( ( faker, id ) => ({ id }) ), // id is passed as second argument of generator function
          makeOtherThing = factory( ( faker, id ) => ({ id }) )
			
    expect( makeThing().id ).toBe( 1 )
    expect( makeThing().id ).toBe( 2 )
    expect( makeThing().id ).toBe( 3 )
    expect( makeThing().id ).toBe( 4 )
			
    expect( makeOtherThing().id ).toBe( 1 )
    expect( makeOtherThing().id ).toBe( 2 )
    expect( makeOtherThing().id ).toBe( 3 )
    expect( makeOtherThing().id ).toBe( 4 )
} )

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.