function assertValid (review) { assert.isString(review.id); assert(review.id); assert.isString(review.userName); assertValidUrl(review.userImage); assert(review.userName); assert.isNotNull(new Date(review.date).toJSON()); assert.isString(review.date); assert(review.date); assert.isNull(review.title); assert.isString(review.text); assert.isNumber(review.score); assert(review.score > 0); assert(review.score <= 5); assertValidUrl(review.url); assert.hasAnyKeys(review, 'replyDate'); assert.hasAnyKeys(review, 'replyText'); assert.hasAnyKeys(review, 'version'); assert.hasAnyKeys(review, 'thumbsUp'); assert.hasAnyKeys(review, 'criterias'); }
function assertValidApp (app) { assert.isString(app.appId); assert.isString(app.title); assert.isString(app.summary); assertValidUrl(app.url); assertValidUrl(app.icon); if (app.score !== undefined) { // would fail for new apps without score assert.isNumber(app.score); assert(app.score >= 0); assert(app.score <= 5); } assert.isBoolean(app.free); // FIXME this is only allowed for preregister, check for that when field is available if (app.priceText !== undefined) { assert.isString(app.priceText); } return app; }
assert.isNumber(app.reviews); assert.isString(app.description); assert.isString(app.descriptionHTML); assert.isString(app.released); assert.isNumber(app.updated); assert.equal(app.genreId, 'GAME_ACTION'); assert.isString(app.version || ''); assert.isString(app.size || ''); assert.isString(app.androidVersionText); assert.isString(app.androidVersion); assert.isString(app.contentRating); assert.isString(app.developer); assert.isString(app.developerId); if (app.developerWebsite) { assertValidUrl(app.developerWebsite); app.comments.map(assert.isString); })); }).timeout(timeout);
assert.isNumber(app.reviews); assert.isString(app.summary); assert.isString(app.description); assert.isString(app.descriptionHTML); assert.isNumber(app.updated); assert.isString(app.released); assert.equal(app.genreId, 'GAME_PUZZLE'); assert.equal(app.familyGenre, undefined); assert.equal(app.familyGenreId, undefined); assert.isString(app.version); if (app.size) { assert.isString(app.size); assert.isString(app.contentRating); assert.isTrue(app.free); assert.isTrue(app.offersIAP); assert.isString(app.IAPRange); app.comments.map(assert.isString); assert.isString(app.recentChanges);
assert.isNumber(app.reviews); assert.isString(app.description); assert.isString(app.descriptionHTML); assert.isNumber(app.updated); assert.hasAnyKeys(app, 'genreId'); assert.isString(app.version || ''); assert.isString(app.size || ''); assert.isString(app.androidVersionText); assert.isString(app.androidVersion); assert.isString(app.contentRating); assert.isString(app.developer); assert.isString(app.developerId); if (app.developerWebsite) { assertValidUrl(app.developerWebsite); app.comments.map(assert.isString); }); });
assert(results.length); results.map((perm) => { assert.isString(perm.permission); assert.isString(perm.type); }); })); assert(results.length); results.map((perm) => { assert.isString(perm.permission); assert.isString(perm.type); }); })); .then((results) => { assert(results.length); results.map(assert.isString); })); .then((results) => { assert(results.length); results.map(assert.isString); })); assert(results.length); results.map((perm) => { assert.isString(perm.permission); assert.isString(perm.type); });
it( 'should create a Matrix having a protected dtype property', function test() { assert.isTrue( mat.hasOwnProperty( 'dtype' ) ); assert.isString( mat.dtype ); expect( foo ).to.throw( Error ); function foo() { mat.dtype = 'beep'; } });
describe('getContentFile()', function() { it('should read test 00 (sub-folder)', function() { let r = getContentFile('test/fixture/00/package.json'); assert.isString(r); assert.equal(r, '{}\n'); }); it('should throw an error by file not found', function() { expect(() => { getContentFile('fileNotFound.json'); }).to.throw(ExecutorError).that.has.property('code', messages.errors.config.internalNotFound.code); }); });
test('getting host ips', () => { const hostIPs = utils.getHostIPs(); assert.isArray(hostIPs); hostIPs.forEach((ip) => { assert.isString(ip, 'IPs are given as'); assert.isTrue(ip.indexOf('.') >= 0 || ip.indexOf(':') >= 0, 'IP format'); }); });
it("Test custom fields log type consistency (objects)", function () { var obj = { "fieldString": "value", "fieldNumber": 123, "fieldObj": { a: 456 }, "fieldArray": [7, 8, 9] }; log("info", "Test", obj); assert.isString(obj.fieldString); assert.isNumber(obj.fieldNumber); assert.isObject(obj.fieldObj); assert.isArray(obj.fieldArray); });
describe('Testing functions in helpers/contentMaker', function(){ it('Testing models content', function(){ assert(contentMaker.modelsContent('hello')) }) it('Testing views content', function(){ assert.isString(contentMaker.modelsContent('hello')) }) it('Testing controllers content', function(){ assert.isString(contentMaker.modelsContent(['function1','function2'])) }) it('Testing routes content', function(){ assert.isString(contentMaker.modelsContent({post: ['/r1','/r2'], get: ['/r3','/r4']})) }) })
describe( 'clean', function() { beforeEach(function(){ plugin = clean.call(context); }); describe( 'return', function ( ) { describe( 'properties', function ( ) { it( 'should define a name property', function () { assert.isString( plugin.name ); } ); it( 'should define a plugin property', function () { assert.isObject( plugin.plugin ); } ); } ); } ); } );
it("Test custom fields log type consistency (arrays)", function () { var obj = ["value", 123, { a: 456 }, [7, 8, 9]]; log("info", "Test", obj); assert.isString(obj[0]); assert.isNumber(obj[1]); assert.isObject(obj[2]); assert.isArray(obj[3]); });
it( 'should create a Matrix having a dtype property', function test() { assert.isTrue( mat.hasOwnProperty( 'dtype' ) ); assert.isString( mat.dtype ); });