.then(otherReaders => {
it('bulkUpsert empty sample query body array', (done) => { bulkUpsert([]) .then((response) => { expect(response).to.be.empty; done(); }); });
it('show retention policies', done => { client.showRetentionPolicies().then(rps => { assert(rps.length); assert.equal(_.keys(rps[0]).sort().join(','), 'default,duration,name,replicaN,shardGroupDuration'); done(); }).catch(done); });
/** * Parse all posts in thread * @async * @param {module:models/post~Post} thread Thread to parse * @return {module:models/post~Post} Parsed thread */ async parseThread(thread) { const promises = [thread].concat(thread.children) .map((post) => this.parseBody(post.body, post.boardUri) .then(result => post.parsed = result)); await Promise.all(promises); return thread; }
/** * Find user by its UID. * @param {String} uid UID. * @return {Object} the user */ findByUid (uid) { return this.find({uid: uid}, {size: 1}).then((users) => { const user = users.length ? users[0] : null return Promise.resolve(user) }) }
describe('String#split', function(){ it('should return an array', function(done){ var url = 'https://www.dcard.tw/f/sex/p/225733687-%EF%BC%83%E5%9C%96-%E9%81%8E%E5%B9%B4%E5%A5%BD%E7%A9%BA%E8%99%9B%E5%A5%BD%E5%AF%82%E5%AF%9E%E5%A5%BD%E5%86%B7'; console.log('url: ', url) dcardModule.fetchTopic(url).then((json)=>{ // assert(Array.isArray([])); console.log('json:', json) done(); },(err)=>{ done(err); }); }); });
it('show field keys of all measurements', done => { client.showFieldKeys().then(fieldKeys => { assert(fieldKeys.length); assert.equal(fieldKeys[0].name, 'http'); assert.equal(_.map(fieldKeys[0].values, item => item.key).join(','), 'code,size,use,uuid'); assert.equal(_.map(fieldKeys[0].values, item => item.type).join(','), 'float,float,float,string'); done(); }).catch(done); });
it('show databases', done => { client.showDatabases().then(dbs => { assert(_.includes(dbs, db), true); done(); }).catch(done); });
it('show measurements', done => { client.showMeasurements().then(measurements => { assert.equal(measurements.length, 2); done(); }).catch(done); });
it('show tag keys of measurement', done => { client.showTagKeys('http').then(tagKeys => { assert(tagKeys.length); assert.equal(tagKeys[0].name, 'http'); assert.equal(_.map(tagKeys[0].values, item => item.key).join(','), 'method,spdy,type'); done(); }).catch(done); });
it('bulkUpsert null sample query body', (done) => { bulkUpsert(null) .then((response) => { expect(response).to.be.empty; done(); }); });
/** * Find user by its API key. * @param {String} key API key. * @return {Object} the user */ findByApiKey (key) { return this.find({apiKey: key}, {size: 1}).then((users) => { const user = users.length ? users[0] : null return Promise.resolve(user) }) }
it('bulkUpsert undefined sample query body', (done) => { bulkUpsert(undefined) .then((response) => { expect(response).to.be.empty; done(); }); });
it('show tag keys of all measurements', done => { client.showTagKeys().then(tagKeys => { assert(tagKeys.length); assert.equal(tagKeys[0].name, 'http'); assert.equal(_.map(tagKeys[0].values, item => item.key).join(','), 'method,spdy,type'); done(); }).catch(done); });