mirror of
https://github.com/kingomarnajjar/flex-template-web.git
synced 2026-07-30 18:16:48 +10:00
Improve test data creation
- Add optional author to listing - Separate user and current user creation
This commit is contained in:
parent
eecda0a101
commit
665728f979
2 changed files with 12 additions and 2 deletions
|
|
@ -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",
|
||||
|
|
|
|||
|
|
@ -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 => {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue