1 parent
cb727c8689
commit
cc2e87754d
6 files changed
+575
-6509
No files matched your search
@@ -0,0 +1,37 @@
|
||||
import { IdMap } from "medusa-test-utils"
|
||||
|
||||
export const customers = {
|
||||
testCustomer: {
|
||||
_id: IdMap.getId("testCustomer"),
|
||||
email: "oliver@medusa.com",
|
||||
first_name: "Oliver",
|
||||
last_name: "Juhl",
|
||||
billingAddress: {},
|
||||
password_hash: "123456789",
|
||||
},
|
||||
deleteCustomer: {
|
||||
_id: IdMap.getId("deleteId"),
|
||||
email: "oliver@medusa.com",
|
||||
first_name: "Oliver",
|
||||
last_name: "Juhl",
|
||||
billingAddress: {},
|
||||
password_hash: "123456789",
|
||||
},
|
||||
}
|
||||
|
||||
export const CustomerModelMock = {
|
||||
create: jest.fn().mockReturnValue(Promise.resolve()),
|
||||
updateOne: jest.fn().mockImplementation((query, update) => {
|
||||
return Promise.resolve()
|
||||
}),
|
||||
deleteOne: jest.fn().mockReturnValue(Promise.resolve()),
|
||||
findOne: jest.fn().mockImplementation(query => {
|
||||
if (query._id === IdMap.getId("testCustomer")) {
|
||||
return Promise.resolve(customers.testCustomer)
|
||||
}
|
||||
if (query._id === IdMap.getId("deleteId")) {
|
||||
return Promise.resolve(customers.deleteCustomer)
|
||||
}
|
||||
return Promise.resolve(undefined)
|
||||
}),
|
||||
}
|
||||
@@ -14,7 +14,6 @@ class CustomerModel extends BaseModel {
|
||||
first_name: { type: String, required: true },
|
||||
last_name: { type: String, required: true },
|
||||
billing_address: { type: AddressSchema },
|
||||
password_hash: { type: String },
|
||||
metadata: { type: mongoose.Schema.Types.Mixed, default: {} },
|
||||
}
|
||||
}
|
||||
|
||||
Reference in new issue
Block a user