static propTypes() { return { errorCode: React.PropTypes.number.isRequired, url: React.PropTypes.string.isRequired } }
describe('#sendMessage', function sendMessageSuite() { before(function before() { utils.handleRatelimit(bot, 'sendMessage', this); }); it('should send a message', function test() { return bot.sendMessage(USERID, 'test').then(resp => { assert.ok(is.object(resp)); assert.ok(is.number(resp.message_id)); }); }); });
yup .number() .integer() .when('maxLength', (maxLength, schema) => { if (maxLength) { return schema.max(maxLength, getTrad('error.validation.minSupMax')); } return schema; }) .nullable()
static get propTypes () { return { level: PropTypes.number } }
composeValidators( () => yup.number().integer(), addMinIntegerValidator, addMaxIntegerValidator )
test.each([ ['number first', [{ number: 1 }, { number: 1.2 }, { number: 2 }]], ['float first', [{ number: 1.2 }, { number: 1 }, { number: 2 }]], ['missing number 1', [{ number: 1 }, {}, { number: 1.2 }]], ['missing number 2', [{ number: 1.2 }, {}, { number: 1 }]], ['mixed type', [{ number: 1.2 }, { number: true }, { number: 'string' }]] ])('prefer float when mixed number types - %s', (_, nodes) => { const schemaComposr = new SchemaComposer() const fields = createFieldDefinitions(nodes) const types = createFieldTypes(schemaComposr, fields, 'Test') expect(types.number.type).toEqual('Float') })
const randomAmount = ({ max, min }, cb) => { if (!max) throw new Error('randomAmount({ max }): max has to be defined!'); const n = faker.random.number({ min: min || 0, max }); let result = []; for (var i = 0; i < n; i++) { result.push(cb(i)); } return result; }
const ticketSchema = (joi) => ({ cinema: joi.string(), schedule: joi.date(), movie: joi.string(), seats: joi.array().items(joi.string()).single(), cinemaRoom: joi.number(), orderId: joi.string().alphanum() })
async function retargetPr( octokit, repoOwner, repoName, pull, to ) { const { headers: { 'x-ratelimit-remaining': remainingRateLimit, 'x-ratelimit-reset': rateLimitReset }, } = await octokit.request( 'PATCH /repos/{owner}/{repo}/pulls/{pull_number}', { owner: repoOwner, repo: repoName, pull_number: pull.number, base: to, } ); return { remainingRateLimit, rateLimitReset }; }
describe('#getWebHookInfo', function getWebHookInfoSuite() { before(function before() { utils.handleRatelimit(bot, 'getWebHookInfo', this); }); it('should return WebhookInfo', function test() { return bot.getWebHookInfo().then(resp => { assert.ok(is.object(resp)); assert.ok(is.boolean(resp.has_custom_certificate)); assert.ok(is.number(resp.pending_update_count)); }); }); });
composeValidators( () => yup.number(), addMinFloatValidator, addMaxFloatValidator )
yup .number() .integer() .when('maxLength', (maxLength, schema) => { if (maxLength) { return schema.max(maxLength, getTrad('error.validation.minSupMax')); } return schema; }) .nullable()
composeValidators( () => yup.number(), addMinFloatValidator, addMaxFloatValidator )