-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
75 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
FROM golang:1.22.2-bullseye AS base | ||
|
||
ENV GOCACHE=/go/.go/cache GOPATH=/go/.go/path TZ=Europe/London PATH=$PATH:$GOPATH/bin | ||
|
||
# Install github.com/cespare/reflex | ||
RUN GOBIN=/bin go install github.com/cespare/[email protected] | ||
RUN GOBIN=/bin go install github.com/kevinburke/go-bindata/v4/[email protected] | ||
RUN PATH=$PATH:/bin | ||
|
||
# Clean cache, as we want all modules in the container to be under /go/.go/path | ||
RUN go clean -modcache | ||
|
||
# Map between the working directories of dev and live | ||
RUN ln -s /go /dp-frontend-feedback-controller | ||
WORKDIR /dp-frontend-feedback-controller |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -510,6 +510,42 @@ func TestValidateForm(t *testing.T) { | |
}, | ||
}, | ||
}, | ||
{ | ||
givenDescription: "the email field has an invalid special character in local part", | ||
given: &model.FeedbackForm{ | ||
Type: mapper.WholeSite, | ||
Description: "A description", | ||
Email: "hello(world)@email.com", | ||
}, | ||
expectedDescription: "an email validation error is returned", | ||
expected: []coreModel.ErrorItem{ | ||
{ | ||
Description: coreModel.Localisation{ | ||
LocaleKey: "FeedbackAlertEmail", | ||
Plural: 1, | ||
}, | ||
URL: "#email-error", | ||
}, | ||
}, | ||
}, | ||
{ | ||
givenDescription: "the email field has invalid domain", | ||
given: &model.FeedbackForm{ | ||
Type: mapper.WholeSite, | ||
Description: "A description", | ||
Email: "[email protected]", | ||
}, | ||
expectedDescription: "an email validation error is returned", | ||
expected: []coreModel.ErrorItem{ | ||
{ | ||
Description: coreModel.Localisation{ | ||
LocaleKey: "FeedbackAlertEmail", | ||
Plural: 1, | ||
}, | ||
URL: "#email-error", | ||
}, | ||
}, | ||
}, | ||
{ | ||
givenDescription: "the email field has a valid email address", | ||
given: &model.FeedbackForm{ | ||
|
@@ -520,6 +556,26 @@ func TestValidateForm(t *testing.T) { | |
expectedDescription: "no validation errors are returned", | ||
expected: []coreModel.ErrorItem(nil), | ||
}, | ||
{ | ||
givenDescription: "the email field is valid with special characters", | ||
given: &model.FeedbackForm{ | ||
Type: mapper.WholeSite, | ||
Description: "A description", | ||
Email: "hello.hello'[email protected]", | ||
}, | ||
expectedDescription: "no validation errors are returned", | ||
expected: []coreModel.ErrorItem(nil), | ||
}, | ||
{ | ||
givenDescription: "the email field is valid with RFC 3696 special characters", | ||
given: &model.FeedbackForm{ | ||
Type: mapper.WholeSite, | ||
Description: "A description", | ||
Email: "hello.`!#$%&'*+-/=?^_{|}[email protected]", | ||
}, | ||
expectedDescription: "no validation errors are returned", | ||
expected: []coreModel.ErrorItem(nil), | ||
}, | ||
{ | ||
givenDescription: "multiple form validation errors", | ||
given: &model.FeedbackForm{ | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# Watch all files ending in .go, excluding files in `.go` or `assets` directory or files | ||
# ending in `_test.go` & run `make debug` when any matching file is changed | ||
-s -r \.go$ -R ^\.go/ -R ^assets/ -R _test\.go$ make debug |