Package Exports
- typeorm-faker
- typeorm-faker/index.js
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (typeorm-faker) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
TypeORM-Faker
Generate fake mocks, stubs using your entity settings.
Usage
// import typeorm faker on your test file.
import * as typeormFaker from 'typeorm-faker';
// here is entity
@Entity('post')
export class Post {
@PrimaryGeneratedColumn()
id!: number;
@Column()
title!: string;
@Column()
text?: string;
@Column({
nullable: false,
default: 0
})
likesCount!: number;
}
// generate stubs
const postStubs = typeormFaker.stub(Post);
// or one
/**
* Post {
* id: 13326,
* title: 'pDYFMFO,ZX',
* text: 'eW2`p3tj*A',
* likesCount: 0`
* }
*/
const postStub = typeormFaker.stubOne(Post);
/**
* you can generate also typeorm raw one
*
* Post {
* post_id: 13326,
* post_title: 'pDYFMFO,ZX',
* post_text: 'eW2`p3tj*A',
* post_likesCount: 0`
* }
*/
const rawPostStub = typeormFaker.stubRawOne(Post);