jcteague / autofixturejs Goto Github PK
View Code? Open in Web Editor NEWgenarates random data fixtures for testing
License: MIT License
genarates random data fixtures for testing
License: MIT License
is there any furture plan to support auto foreign key generation?
that would be great.
Are there @types/autofixture
?
This project has been around for a long time. When I first started it, it was pre ES6 and the internals is starting to show it's age it's time for a rewrite.
I think the fixture definition api has stood to the test in time and I don't forsee making any changes to how fixtures are defined, but export them seperately so you can import them directly into your tests.
const UserFixture = Factory.create('User', [
'firstName',
'lastName',
'email'.asEmail(),
]);
module.exports = {
UserFixture,
}
However, a plugin approach for builder functions might be interesting so you could create new types of builders could be interesting. It's not hard right now, just add a function following the pattern of existing builders. But you have to add it in all tests, or setup to use.
Factory.addBuilder('customValueBuilder', (fieldName, increment, {param1, param2}) => {
return value_for_field
});
const UserFixture = Factory.define([
'customValue'.customValueBuilder(1, 2),
]);
Moving to module import approach to using a fixture, first suggested in this issue
const {UserFixture} = require('../fixtures')
const fixture1 = UserFixture.create(); //simplest use, all defaults
const fixture2 = UserFixture.create({
firstName: 'firstName', // simple overiding
email: (incrementer) => `email${incrementer}@example.com` // new feature
});
// exists today, but a little clunky
const fixture = UserFixture.create((fixture)=>{
fixture.firstName = 'firstName'
});
Any other suggestions?
I'm going to start work in this version this week
Hi
Please accept my apologies if you consider this a misuse of a GitHub issue.
I came across this project today because I have a search agent set up to watch for the name AutoFixture, and just wanted to drop you a line... Please read on, this isn't a cease and desist letter - just a friendly note that the name may confuse some users...
The reason I have a search agent looking for the name AutoFixture is that I'm the inventor and Benevolent Dictator of a fairly successful open source project called AutoFixture.
Now, you are entirely free to use the name AutoFixture for a Javascript implementation - you probably arrived at the name the same way that I did. However, I just wanted to point you to the existing AutoFixture project, because it may be a potential source of confusion to users.
Obviously, node programmers are likely to be blissfully unaware of the .NET AutoFixture project, but people with prior experience with AutoFixture for .NET may be confused if autofixturejs uses completely different concepts, etc.
Additionally, it may make it difficult to search for AutoFixture documentation, etc. The reason I'm writing is that this has the potential to confuse both AutoFixture .NET users, as well as autofixturejs users.
Perhaps we could deal with such potential issues in one of the following ways:
You are completely free to ignore this message, and keep working on your project. My motivation for writing to you is only that, based on the ReadMe for this project, it looks like you're unaware of the existing AutoFixture project, and I just wanted to point out to you that prior art exists, and that it may confuse your potential users.
Instead of defining a name for the factory model, just return it so it can be exported and the ES6 module system can be used to resolve fixtures
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.