|
1 | 1 |
|
2 | | -import { fromJS } from "immutable" |
| 2 | +import { fromJS, List } from "immutable" |
3 | 3 | import reducer from "core/plugins/spec/reducers" |
4 | 4 |
|
5 | 5 | describe("spec plugin - reducer", function(){ |
@@ -149,6 +149,7 @@ describe("spec plugin - reducer", function(){ |
149 | 149 | const response = result.getIn(["meta", "paths", path, method, "parameters", "body.myBody", "value"]) |
150 | 150 | expect(response).toEqual(`{ "a": 123 }`) |
151 | 151 | }) |
| 152 | + |
152 | 153 | it("should store parameter values by identity", () => { |
153 | 154 | const updateParam = reducer["spec_update_param"] |
154 | 155 |
|
@@ -176,6 +177,27 @@ describe("spec plugin - reducer", function(){ |
176 | 177 | const value = result.getIn(["meta", "paths", path, method, "parameters", `body.myBody.hash-${param.hashCode()}`, "value"]) |
177 | 178 | expect(value).toEqual(`{ "a": 123 }`) |
178 | 179 | }) |
| 180 | + |
| 181 | + it("should store a multi-value parameter as an immutable list", () => { |
| 182 | + const updateParam = reducer["spec_update_param"] |
| 183 | + |
| 184 | + const path = "/pet/post" |
| 185 | + const method = "POST" |
| 186 | + |
| 187 | + const state = fromJS({}) |
| 188 | + const result = updateParam(state, { |
| 189 | + payload: { |
| 190 | + path: [path, method], |
| 191 | + paramName: "myBody", |
| 192 | + paramIn: "body", |
| 193 | + value: [ "a", "b" ], |
| 194 | + isXml: false |
| 195 | + } |
| 196 | + }) |
| 197 | + |
| 198 | + const response = result.getIn(["meta", "paths", path, method, "parameters", "body.myBody", "value"]) |
| 199 | + expect(List.isList(response)).toEqual(true) |
| 200 | + }) |
179 | 201 | }) |
180 | 202 | describe("SPEC_UPDATE_EMPTY_PARAM_INCLUSION", function() { |
181 | 203 | it("should store parameter values by {in}.{name}", () => { |
|
0 commit comments