-
Notifications
You must be signed in to change notification settings - Fork 1.5k
Closed
Description
Support plan
- which support plan is this issue covered by? (e.g. Community, Core, Plus, or Enterprise): community
- is this issue currently blocking your project? (yes/no): no
- is this issue affecting a production system? (yes/no): ? -- the output impacts anyone who uses a number of different validation mechanisms, validation still happens, but the reporting is grammatically poor.
Context
- node version: any
- module version with issue: dbde086
- last module version without issue: 6a267f2 (for everything except dates)
- environment (e.g. node, browser, native): all
- used with (e.g. hapi application, another framework, standalone, ...): any
- any other relevant information: I think I first spotted this in some random project, and then I just browsed the source. I'm reporting this as an issue because your PR guidelines suggest that I shouldn't create a PR first.
What are you trying to achieve or the steps to reproduce?
'use strict';
const Code = require('@hapi/code');
const Joi = require('..'); /* yes, this is stolen from test/base.js */
const Lab = require('@hapi/lab');
const { describe, it } = exports.lab = Lab.script();
const { expect } = Code;
describe('placeholder', () => {
it('should have proper English grammar', () => {
const schema = Joi.object({
c: Joi.number().min(0).integer().strict().error((errors) => {
return new Error(errors.join(' and ')); // Automatic toString() of each error on join
})
});
const err = schema.validate({ c: -1 }, { abortEarly: false }).error;
expect(err.message).to.equal('"c" must be greater than or equal to 0');
});
});What was the result you got?
'"c" must be larger than or equal to 0'
What result did you expect?
'"c" must be greater than or equal to 0'
Some references:
Unicode Character 'LESS-THAN SIGN' (U+003C)
Unicode Character 'GREATER-THAN SIGN' (U+003E)
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
bugBug or defectBug or defect