resultSet.series().map((s, index) => ({ label: s.title, data: minutesAgo.map((minute) => { const value = s.series.find(i => i.category === minute) return (value && value.value) || 0 }), backgroundColor: COLORS_SERIES[index], fill: false }))
it('should fetch a valid application list for the new paid collection and FAMILY category', () => { return gplay.list({ collection: gplay.collection.NEW_PAID, category: gplay.category.FAMILY, num: 100 }) .then((apps) => apps.map(assertValidApp)) .then((apps) => apps.map((app) => assert.isFalse(app.free))); }).timeout(timeout);
test('Get article1 with cat3', async () => { let { body } = await rq({ url: `/content-manager/explorer/application::article.article/${data.articles[0].id}`, method: 'GET', }); expect(body.id); expect(body.category.id).toBe(data.categories[2].id); });
beforeAll(async () => { const token = await registerAndLogin(); rq = createAuthRequest(token); modelsUtils = createModelsUtils({ rq }); await modelsUtils.createContentTypes([ form.article, form.tag, form.category, form.reference, form.product, ]); }, 60000);
/** * Checks if a category exists * @param {string} name category name to serach for */ const categoryExists = name => { const matchingIndex = Object.values(strapi.components).findIndex( component => component.category === name ); return matchingIndex > -1; }
function validate (opts) { if (opts.category && !R.contains(opts.category, R.values(c.category))) { throw Error('Invalid category ' + opts.category); } opts.collection = opts.collection || c.collection.TOP_FREE; if (!R.contains(opts.collection, R.values(c.collection))) { throw Error(`Invalid collection ${opts.collection}`); } if (opts.age && !R.contains(opts.age, R.values(c.age))) { throw Error(`Invalid age range ${opts.age}`); } }
it('should validate the collection', () => { return gplay.list({ category: gplay.category.GAME_ACTION, collection: 'wrong' }) .then(assert.fail) .catch((e) => assert.equal(e.message, 'Invalid collection wrong')); });
Object.keys(strapi.components).map(key => { const compo = strapi.components[key]; return { category: compo.category, modelName: compo.modelName, plugin: compo.modelName, uid: compo.uid, filename: compo.__filename__, dir: path.join(strapi.dir, 'components', compo.category), schema: compo.__schema__, }; })
// fetch last page of new paid apps, which have a bigger chance of including // results with no downloads (less fields, prone to failures) it('It should not fail with apps with no downloads', () => gplay.list({ category: gplay.category.GAME_ACTION, collection: gplay.collection.TOP_PAID, num: 20 }) .then((apps) => apps.map(assertValidApp)));
it('should be able to retreive a list for each category', () => { const categoryIds = Object.keys(gplay.category); const fetchCategory = (category) => gplay.list({ category, collection: gplay.collection.TOP_FREE, num: 10 }).catch(() => { assert.equal(category, void 0, 'invalid category'); }); return Promise.all(categoryIds.map(fetchCategory)); }).timeout(200 * 1000);
it('It should not fail with apps with no downloads and fullDetail', () => gplay.list({ category: gplay.category.GAME_ACTION, collection: gplay.collection.TOP_FREE, num: 10, fullDetail: true }) .then((apps) => apps.map(assertValidApp)) ).timeout(timeout);
it('should fetch a valid application list for the given category and collection', () => { return gplay.list({ category: gplay.category.GAME_ACTION, collection: gplay.collection.TOP_FREE }) .then((apps) => apps.map(assertValidApp)) .then((apps) => apps.map((app) => assert(app.free))); }).timeout(timeout);
test('Get article2 with cat2', async () => { const { body } = await rq({ url: `/articles/${data.articles[1].id}`, method: 'GET', }); expect(body.id); expect(body.category.id).toBe(data.categories[1].id); });
test('Get article2 with cat2', async () => { const { body } = await rq({ url: `/articles/${data.articles[1].id}`, method: 'GET', }); expect(body.id); expect(body.category.id).toBe(data.categories[1].id); });
Object.keys(strapi.components).map(key => { const compo = strapi.components[key]; return { category: compo.category, modelName: compo.modelName, plugin: compo.modelName, uid: compo.uid, filename: compo.__filename__, dir: path.join(strapi.dir, 'components', compo.category), schema: compo.__schema__, }; })