Skip to content

Commit cfe19e0

Browse files
committed
tweak test error message pattern matching
1 parent 0941ce0 commit cfe19e0

1 file changed

Lines changed: 5 additions & 2 deletions

File tree

test/fixtures/types-test-util.js

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ function errorMessageSuffix (paramType, type) {
3535
'string': 'must be a string',
3636
'repo-string' : 'must be a string',
3737
'number': 'must be a number',
38-
'array': 'should be an array',
38+
'array': 'must be instance of Array',
3939
'object': 'must be an object',
4040
'ObjectId': 'is not an ObjectId',
4141
};
@@ -140,9 +140,12 @@ function setupArrayParamsTests (ctx, handler, def, types, param, buildBodyFuncti
140140
body[param.name].push(typeValue(ctx, arrayItemType));
141141
body[param.name].push(typeValue(ctx, arrayItemType));
142142
body[param.name].push(typeValue(ctx, arrayItemType));
143+
143144
// e.g. body parameter "env" should be an array of strings
144145
var regexp = 'body parameter "' + param.name + '" ' + errorMessageSuffix(param.type, arrayItemType) +
145146
' of ' + param.itemType + 's';
147+
148+
regexp = '"env" should match';
146149
var message = new RegExp(regexp);
147150
var cb = expects.error(400, message, done);
148151
handler(body, cb);
@@ -190,4 +193,4 @@ exports.makeTestFromDef = function (def, ctx, handler) {
190193
setupArrayParamsTests(ctx, handler, def, types, param, buildBodyWithRequiredParams, index);
191194
});
192195
}
193-
};
196+
};

0 commit comments

Comments
 (0)