Giter VIP home page Giter VIP logo

kitimat's People

Contributors

garbles avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

Forkers

minikeb

kitimat's Issues

Create "or" Fuzzer

import { string, integer } from 'kitimat-jest';

const fuzz = string().or(integer());

Code generation from TS type aliases

TS exposes custom transformers through the public API, so it should be possible to create generates purely from a type alias. I've done something like before with babel as Flow.

import { fromType } from 'kitimat-type-to-gen';

const person = fromType<Person>();

// would expand to something like...

const kitimat = require('kitimat-jest');
const person = kitimat.object<Person>({
  name: kitimat.string(),
  age: kitimat.posInt(),
  // ... etc
});

Create Scalecheck-like "exists" for kitimat-jest

Seems like this would involve allowing a property to accept a runner as an argument. Create a new runner that would complete as soon as a single test case proves the property. In kitimat-jest it would look the same as check

import { integer, exists } from 'kitimat-jest';

exists("a thing", integer(), a => expect(a).toEqual(0));

Create "fuzz" helper for kitimat-jest

This function would be the "snapshot testing" of property-based tests - don't want to use much effort and just have something that does a general sanity check that the function won't throw.

import { integer } from 'kitimat-jest';

fuzz('my func doesn\'t throw', [integer()], int => myFunc(int));

Maybe this should also try to throw garbage and see that there is an exception if the wrong type is passed.

Create kitimat-options package

We should be able to specify what options are defaults and which can simply be an extension so that we don't have to continuously add options for things that we don't care about, e.g. kitimat-jest is the only thing that cares about the timeout option.

Also, the options.ts module is the only thing that relies on path and cosmiconfig which makes it annoying to use Kitimat directly in the browser. (something I want to do)

Create "number" Fuzzer

Seems more natural for someone to use number instead of integer or float.

import { number } from 'kitimat-jest';

const fuzz = number();

GraphQL bindings.

Inspired by mockServer in GraphQL tools, create GraphQL bindings for Kitimat. Given a schema.json and a query, I should create a generator.

import { fromGraphQL } from 'kitimat-graphql';
improt schema from './schema.json';

const server = fromGraphQL(schema);

const queryGen = server(`query {
  me {
    id
    name
  }
}`);

check('my component renders', queryGen, result => {
  // ...
});

I'm already squating kitimat-graphql in packages.

kitimat-ava

I'd be interested in an integration with the ava test runner, since it's what I use. (I'm open to contributing myself, but I have a lot of other projects. Hopefully it's not too hard, and so I'll give it a try since I know ava stuff ๐Ÿ˜…)

Jest reporter doesn't show failing arguments

While experimenting with this library, I found an issue that seemingly makes it very difficult to work with. It could be that I'm doing something wrong, or that there have been changes in jest since this library was last updated.

Demonstration code:
https://github.com/chrismilleruk/testapp/tree/kitimat-jest

Given a simple generative test which fails:

check('Always starts with a letter', 
  [string(), string()], 
  (generatedPrefix, generatedName) => {
  const module = new Greeting(generatedPrefix);
  const result = module.sayHello(generatedName);

  // Always starts with a letter
  expect(result[0]).toMatch(/[A-Za-z]/);
});

The reporter output doesn't provide

  • the arguments which caused the failure.
  • the seed used to create the arguments.
...
โœ• Always starts with a letter (seed: undefined, source: undefined) (26ms)
โœ“ Has four basic formats (33ms)

โ— Greeting Class โ€บ Always starts with a letter (seed: undefined, source: undefined)

expect(received).toMatch(expected)

Expected pattern: /[A-Za-z]/
Received string:  " "

  37 |
  38 |     // Always starts with a letter
> 39 |     expect(result[0]).toMatch(/[A-Za-z]/);
     |                       ^
  40 |   });
...

propTypes bindings

Make it possible to use React propTypes to generate props for your component.

import { fromPropTypes } from 'kitimat-prop-types';
jest.mock('prop-types', () => require('kitimat-prop-types/mock'));

import { App } from './app';

const propsGen = fromPropTypes(App);

// ...

Already squating on kitimat-prop-types in packages.

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.