@@ -60,8 +60,9 @@ Create the following test cases for `CandyStore.Item`.
60
60
Create a ` CandyStore.ItemTest ` module in ` tests/item_test.ex ` .
61
61
62
62
Create the following test cases for the following:
63
- - given a ` :name ` , ` :cost ` , and ` :type ` field it should create an Item struct.
64
- - The Item struct should enforce the ` :name ` and ` :type ` fields.
63
+
64
+ * given a ` :name ` , ` :cost ` , and ` :type ` field it should create an Item struct.
65
+ * The Item struct should enforce the ` :name ` and ` :type ` fields.
65
66
66
67
## Create the CandyStore.search/2 Function
67
68
@@ -78,22 +79,23 @@ CandyStore.search(items, query)
78
79
Create a ` CandyStore.search/2 ` function and the following test cases:
79
80
(You may use any test names, so long as your tests cover the following functionality)
80
81
81
- - given a list of items, when searching the full name of one item, then it should only find matching items.
82
- - given a list of items, when searching the partial name of one item, then it should only find matching items.
83
- - given a list of items, when searching the a non matching name, it should find no items.
84
- - given a list of items, when searching by type, it should find matching items.
85
- - given a list of items, when searching by a non-matching type, it should find no items.
86
- - given a list of items, when searching by exact cost, it should find matching items.
87
- - given a list of items, when searching by all filters (: type , : cost , and : name ) it should find matching items.
82
+ * given a list of items, when searching the full name of one item, then it should only find matching items.
83
+ * given a list of items, when searching the partial name of one item, then it should only find matching items.
84
+ * given a list of items, when searching the a non matching name, it should find no items.
85
+ * given a list of items, when searching by type, it should find matching items.
86
+ * given a list of items, when searching by a non-matching type, it should find no items.
87
+ * given a list of items, when searching by exact cost, it should find matching items.
88
+ * given a list of items, when searching by all filters (: type , : cost , and : name ) it should find matching items.
88
89
89
90
Ensure all tests pass.
90
91
91
92
## (Bonus) Search By Price
92
93
93
94
Add the following functionality and cases to allow users to search by price:
94
- - given a list of items, when searching by ` :max_cost ` , it should find items below the max cost.
95
- - given a list of items, when searching by ` :min_cost ` , it should find items below the max cost.
96
- - given a list of items, when searching by ` :cost ` with a range, it should find items within the range.
95
+
96
+ * given a list of items, when searching by ` :max_cost ` , it should find items below the max cost.
97
+ * given a list of items, when searching by ` :min_cost ` , it should find items below the max cost.
98
+ * given a list of items, when searching by ` :cost ` with a range, it should find items within the range.
97
99
98
100
## (Bonus) Item Validation
99
101
@@ -104,10 +106,10 @@ Use `Ecto Changesets` validate the `Item` struct in an `Item.new/1` function.
104
106
105
107
Then create the following test cases:
106
108
107
- - ` Item.new/1 ` should return a changeset error if ` :name ` is not a string.
108
- - ` Item.new/1 ` should return a changeset error if ` :type ` is not an atom.
109
- - ` Item.new/1 ` should return a changeset error if ` :cost ` is not a integer.
110
- - ` Item.new/1 ` should return a struct if ` :name ` , ` :type ` , and ` :cost ` are all valid.
109
+ * ` Item.new/1 ` should return a changeset error if ` :name ` is not a string.
110
+ * ` Item.new/1 ` should return a changeset error if ` :type ` is not an atom.
111
+ * ` Item.new/1 ` should return a changeset error if ` :cost ` is not a integer.
112
+ * ` Item.new/1 ` should return a struct if ` :name ` , ` :type ` , and ` :cost ` are all valid.
111
113
112
114
## Commit Your Progress
113
115
@@ -116,4 +118,4 @@ Run the following in your command line from the project folder to track and save
116
118
```
117
119
$ git add .
118
120
$ git commit -m "finish candy store exercise"
119
- ```
121
+ ```
0 commit comments