Skip to content

Commit

Permalink
Update device/prime volume to allow maximum of 10 units for cannula
Browse files Browse the repository at this point in the history
  • Loading branch information
Darin Krauss authored and darinkrauss committed Oct 19, 2017
1 parent d8611b8 commit a8e27ac
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion data/types/device/prime/prime.go
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ func (p *Prime) Validate(validator data.Validator) error {

if p.Target != nil {
if *p.Target == "cannula" {
validator.ValidateFloat("volume", p.Volume).InRange(0.0, 3.0)
validator.ValidateFloat("volume", p.Volume).InRange(0.0, 10.0)
} else if *p.Target == "tubing" {
validator.ValidateFloat("volume", p.Volume).InRange(0.0, 100.0)
}
Expand Down
8 changes: 4 additions & 4 deletions data/types/device/prime/prime_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -56,16 +56,16 @@ var _ = Describe("Prime", func() {
Context("cannula volume", func() {
DescribeTable("invalid when", testData.ExpectFieldNotValid,
Entry("is less than 0", NewRawObjectWithCannula(), "volume", -0.1,
[]*service.Error{testData.ComposeError(service.ErrorValueNotInRange(-0.1, 0.0, 3.0), "/volume", NewMeta())},
[]*service.Error{testData.ComposeError(service.ErrorValueNotInRange(-0.1, 0.0, 10.0), "/volume", NewMeta())},
),
Entry("is more than 3", NewRawObjectWithCannula(), "volume", 3.1,
[]*service.Error{testData.ComposeError(service.ErrorValueNotInRange(3.1, 0.0, 3.0), "/volume", NewMeta())},
Entry("is more than 10", NewRawObjectWithCannula(), "volume", 10.1,
[]*service.Error{testData.ComposeError(service.ErrorValueNotInRange(10.1, 0.0, 10.0), "/volume", NewMeta())},
),
)

DescribeTable("valid when", testData.ExpectFieldIsValid,
Entry("is 0", NewRawObjectWithCannula(), "volume", 0.0),
Entry("is 3.0", NewRawObjectWithCannula(), "volume", 3.0),
Entry("is 10.0", NewRawObjectWithCannula(), "volume", 10.0),
Entry("is no decimal", NewRawObjectWithCannula(), "volume", 2),
)
})
Expand Down

0 comments on commit a8e27ac

Please sign in to comment.