updates on the ai agents and time series prediction and updates on the api to
This commit is contained in:
@@ -17,6 +17,9 @@ func validOnboarding() onboardClientRequest {
|
||||
Phone: "+91 98765-43210",
|
||||
Password: "s3cure-pass",
|
||||
Applocationid: 1,
|
||||
// Required since clients carry a delivery category: it sets their
|
||||
// pricing and whether their parcels can be returned at all.
|
||||
Deliverycategory: "Clothing",
|
||||
}
|
||||
}
|
||||
|
||||
@@ -32,19 +35,21 @@ func TestOnboardingValidateNormalises(t *testing.T) {
|
||||
|
||||
func TestOnboardingValidateRefuses(t *testing.T) {
|
||||
cases := map[string]func(*onboardClientRequest){
|
||||
"company name is required": func(r *onboardClientRequest) { r.Companyname = " " },
|
||||
"company name is too long": func(r *onboardClientRequest) { r.Companyname = strings.Repeat("a", 121) },
|
||||
"contact person's name": func(r *onboardClientRequest) { r.Contactname = "" },
|
||||
"valid email": func(r *onboardClientRequest) { r.Email = "not-an-email" },
|
||||
"valid email ": func(r *onboardClientRequest) { r.Email = "Ops <ops@acme.example>" },
|
||||
"valid email ": func(r *onboardClientRequest) { r.Email = "ops@localhost" },
|
||||
"10-digit mobile": func(r *onboardClientRequest) { r.Phone = "12345" },
|
||||
"10-digit mobile ": func(r *onboardClientRequest) { r.Phone = "5876543210" }, // must start 6-9
|
||||
"at least 8 characters": func(r *onboardClientRequest) { r.Password = "short" },
|
||||
"at most 72 characters": func(r *onboardClientRequest) { r.Password = strings.Repeat("x", 73) },
|
||||
"must not be the email": func(r *onboardClientRequest) { r.Password = "OPS@acme.example" },
|
||||
"must not be the email or the ": func(r *onboardClientRequest) { r.Password = "9876543210" },
|
||||
"operating city": func(r *onboardClientRequest) { r.Applocationid = 0 },
|
||||
"choose what this client delivers": func(r *onboardClientRequest) { r.Deliverycategory = " " },
|
||||
"not a delivery category we price for": func(r *onboardClientRequest) { r.Deliverycategory = "Groceries" },
|
||||
"company name is required": func(r *onboardClientRequest) { r.Companyname = " " },
|
||||
"company name is too long": func(r *onboardClientRequest) { r.Companyname = strings.Repeat("a", 121) },
|
||||
"contact person's name": func(r *onboardClientRequest) { r.Contactname = "" },
|
||||
"valid email": func(r *onboardClientRequest) { r.Email = "not-an-email" },
|
||||
"valid email ": func(r *onboardClientRequest) { r.Email = "Ops <ops@acme.example>" },
|
||||
"valid email ": func(r *onboardClientRequest) { r.Email = "ops@localhost" },
|
||||
"10-digit mobile": func(r *onboardClientRequest) { r.Phone = "12345" },
|
||||
"10-digit mobile ": func(r *onboardClientRequest) { r.Phone = "5876543210" }, // must start 6-9
|
||||
"at least 8 characters": func(r *onboardClientRequest) { r.Password = "short" },
|
||||
"at most 72 characters": func(r *onboardClientRequest) { r.Password = strings.Repeat("x", 73) },
|
||||
"must not be the email": func(r *onboardClientRequest) { r.Password = "OPS@acme.example" },
|
||||
"must not be the email or the ": func(r *onboardClientRequest) { r.Password = "9876543210" },
|
||||
"operating city": func(r *onboardClientRequest) { r.Applocationid = 0 },
|
||||
}
|
||||
for want, mutate := range cases {
|
||||
r := validOnboarding()
|
||||
|
||||
Reference in New Issue
Block a user