Improve test data creation

- Add optional author to listing
 - Separate user and current user creation
This commit is contained in:
Kimmo Puputti 2017-04-19 15:07:28 +03:00
parent eecda0a101
commit 665728f979
2 changed files with 12 additions and 2 deletions

View file

@ -8,7 +8,6 @@ exports[`CheckoutPage matches snapshot 1`] = `
author={
Object {
"attributes": Object {
"email": "author@example.com",
"profile": Object {
"firstName": "author first name",
"lastName": "author last name",

View file

@ -4,11 +4,21 @@ const { UUID, LatLng, Money } = types;
// Create a user that conforms to the util/propTypes user schema
export const createUser = id => ({
id: new UUID(id),
type: 'user',
attributes: {
profile: { firstName: `${id} first name`, lastName: `${id} last name`, slug: `${id}-slug` },
},
});
// Create a user that conforms to the util/propTypes user schema
export const createCurrentUser = id => ({
id: new UUID(id),
type: 'user',
attributes: {
email: `${id}@example.com`,
profile: { firstName: `${id} first name`, lastName: `${id} last name`, slug: `${id}-slug` },
stripeConnected: true,
},
});
@ -35,7 +45,7 @@ export const createImage = id => ({
});
// Create a user that conforms to the util/propTypes listing schema
export const createListing = id => ({
export const createListing = (id, author = null) => ({
id: new UUID(id),
type: 'listing',
attributes: {
@ -45,6 +55,7 @@ export const createListing = id => ({
address: `${id} address`,
geolocation: new LatLng(40, 60),
},
author,
});
export const createTransaction = options => {