t('big query body', async() => { await sql`create table test (x int)` return [1000, (await sql`insert into test ${ sql([...Array(1000).keys()].map(x => ({ x }))) }`).count, await sql`drop table test`] })
test('should return an array iterator when array.keys is called', t => { let count = 0; let callbackCount = 0; const array = ['a', 'b', 'c']; const proxy = onChange(array, () => { callbackCount++; }); for (const index of proxy.keys()) { t.is(count++, index); } t.is(callbackCount, 0); });
it('should not interfere with calls of different request ID', async () => { let counter = 0; Parse.Cloud.afterSave('MyClass', () => { counter++; }); const promises = [...Array(100).keys()].map(() => { const params = { method: 'POST', url: 'http://localhost:8378/1/classes/MyClass', headers: { 'X-Parse-Application-Id': Parse.applicationId, 'X-Parse-Master-Key': Parse.masterKey, 'X-Parse-Request-Id': uuid.v4() } }; return request(params); }); await expectAsync(Promise.all(promises)).toBeResolved(); expect(counter).toBe(100); });
it('$nor valid query', (done) => { const objects = Array.from(Array(10).keys()).map((rating) => { return new TestObject({ rating: rating }); });
this.shardList = [...Array(amount).keys()];
it('containedBy pointer array', (done) => { const objects = Array.from(Array(10).keys()).map((idx) => { const obj = new Parse.Object('Object'); obj.set('key', idx);
t('Throws if more than 65534 parameters', async() => { await sql`create table test (x int)` return ['MAX_PARAMETERS_EXCEEDED', (await sql`insert into test ${ sql([...Array(65535).keys()].map(x => ({ x }))) }`.catch(e => e.code)), await sql`drop table test`] })
// 解析 font 相关属性 Array.prototype.forEach.call(style, function (key) { if (key === 'font-family') { model.family = utils.unquotation(style['font-family']); } else if (key === 'font') { model.options = utils.fontValueParse(style.font) || {}; model.family = model.options['font-family']; if (Array.isArray(model.family)) { model.family = model.family[0]; } delete model.options['font-family']; } else if (getFontId.keys.indexOf(key) !== -1) { model.options[key] = style[key]; } });
function genPutTagObj(size, duplicate) { const retTagSet = []; Array.from(Array(size).keys()).forEach(ind => { retTagSet.push({ Key: duplicate ? 'dupeKey' : `key${ind}`, Value: `Value${ind}`, }); }); return retTagSet; }
/** * Gets values of the `ignores` option. * * @returns {string[]} Values of the `ignores` option. */ function getIgnoresEnum() { return Object.keys( OPTIONS.reduce((retv, key) => { for (const alias of FEATURES[key].alias) { retv[alias] = true } retv[key] = true return retv }, Object.create(null)) ) }
generateManyBucketNames(numberOfBuckets) { const random = Math.round(Math.random() * 100).toString(); return Array .from(Array(numberOfBuckets).keys()) .map(i => `${baseName}-${random}-${i}`); }
// 解析 font 相关属性 Array.prototype.forEach.call(style, function (key) { if (key === 'font-family') { model.family = utils .commaToArray(style['font-family']) .map(utils.unquotation); } else if (key === 'font') { model.options = utils.fontValueParse(style.font) || {}; model.family = model.options['font-family']; delete model.options['font-family']; } else if (getFontId.keys.indexOf(key) !== -1) { model.options[key] = style[key]; } });