Best JavaScript code snippet using pact-foundation-pact
UtilitiesFactory.js
Source:UtilitiesFactory.js
1'use strict';2chai.Assertion.addProperty('lowercase', function () {3 var obj = this._obj;4 new chai.Assertion(obj).to.be.a('string');5 this.assert(obj === obj.toLowerCase(), 'expected #{this} to be all lowercase', 'expected #{this} to not be all lowercase');6});7describe('UtilitiesFactory', function () {8 var UtilitiesFactory, Session;9 beforeEach(inject(function(){10 var $injector = angular.injector(['ui.router', 'ngMock', 'wasabi', 'wasabi.services']);11 UtilitiesFactory = function () {12 return $injector.get('UtilitiesFactory');13 };14 15 Session = function () {16 return $injector.get('Session');17 };18 }));19 describe('Constructor', function () {20 it('exists and has correct properties', function () {21 var factory = new UtilitiesFactory();22 var properties = ['stateImgUrl', 'stateName', 'capitalizeFirstLetter', 'arrayToString', 'selectTopLevelTab', 'hideTopLevelTab', 'displayPageError', 'hideHeading', 'handleGlobalError', 'extractErrorFromResponse', 'failIfTokenExpired', 'trackEvent', 'doTrackingInit', 'formatApplicationList', 'filterAppsForUser', 'hasPermission', 'hasAdmin', 'getAppsWithAnyPermissions', 'getAdministeredApplications', 'userHasRole', 'userHasRoleForApplication', 'sortByHeadingValue', 'actionRate', 'actionDiff', 'significance', 'saveFavorite', 'removeFavorite', 'retrieveFavorites', 'getBucket', 'getFormattedStartAndEndDates', 'determineBucketImprovementClass'];23 properties.forEach(function(d){24 expect(factory).to.have.property(d).that.is.a('function');25 });26 });27 });28 describe('#stateImgUrl', function () {29 it('returns a .png path given valid input', function () {30 var factory = new UtilitiesFactory();31 var result = factory.stateImgUrl('test');32 expect(result).to.be.a('string');33 expect(result).to.include('.png');34 });35 it('returns lower case .png path given valid input', function () {36 var factory = new UtilitiesFactory();37 var result = factory.stateImgUrl('TEST');38 expect(result).to.be.lowercase;39 });40 });41 describe('#stateName', function () {42 it('returns "stopped" given input "paused"', function () {43 var factory = new UtilitiesFactory();44 var result = factory.stateName('paused');45 expect(result).to.eql('stopped');46 });47 it('returns input given non-"paused" input', function () {48 var factory = new UtilitiesFactory();49 var result = factory.stateName('hello');50 var result2 = factory.stateName('HelLO');51 expect(result).to.eql('hello');52 expect(result2).to.eql('hello');53 });54 });55 describe('#capitalizeFirstLetter', function () {56 it('returns input with only first letter capitalized', function () {57 var factory = new UtilitiesFactory();58 var cases = [59 ['hello', 'Hello'],60 ['hello world', 'Hello world'],61 ['1day', '1day']62 ];63 cases.forEach(function(d){64 expect(factory.capitalizeFirstLetter(d[0])).to.eql(d[1]);65 });66 });67 });68 // describe('#arrayToString', function () {69 // it('')70 // });71 describe('#selectTopLevelTab', function () {72 it('performs correctly without permissions', function () {73 var factory = new UtilitiesFactory();74 sinon.spy(factory, 'hasAdmin');75 factory.selectTopLevelTab('Users');76 expect(factory.hasAdmin.calledOnce).to.eql(true);77 });78 79 it('performs correctly while bypassing permissions with admin', function () {80 var factory = new UtilitiesFactory();81 factory._isTesting = true;82 sinon.spy(factory, 'hideTopLevelTab');83 factory.selectTopLevelTab('Users', ['ADMIN']);84 expect(factory.hideTopLevelTab.called).to.eql(true);85 });86 87 it('performs correctly while bypassing permissions without admin', function () {88 var factory = new UtilitiesFactory();89 factory._isTesting = true;90 sinon.spy(factory, 'hideTopLevelTab');91 factory.selectTopLevelTab('Users', []);92 expect(factory.hideTopLevelTab.called).to.eql(true);93 });94 });95 describe('#hideTopLevelTab', function () {96 it('does not throw with hideIt=true', function () {97 var factory = new UtilitiesFactory();98 sinon.spy(factory, 'hasAdmin');99 var testFn = function () { factory.hideTopLevelTab('Users', true); };100 expect(testFn).to.not.throw(Error);101 });102 103 it('does not throw with hideIt=false', function () {104 var factory = new UtilitiesFactory();105 sinon.spy(factory, 'hasAdmin');106 var testFn = function () { factory.hideTopLevelTab('Users', false); };107 expect(testFn).to.not.throw(Error);108 });109 110 it('does not throw with hideIt=undefined', function () {111 var factory = new UtilitiesFactory();112 sinon.spy(factory, 'hasAdmin');113 var testFn = function () { factory.hideTopLevelTab('Users'); };114 expect(testFn).to.not.throw(Error);115 });116 });117 describe('#displayPageError', function () {118 it('does not throw with show=true', function () {119 var factory = new UtilitiesFactory();120 var testFn = function () { factory.displayPageError('Users', 'hello', true); };121 expect(testFn).to.not.throw(Error);122 });123 124 it('does not throw with show=false', function () {125 var factory = new UtilitiesFactory();126 var testFn = function () { factory.displayPageError('Users', 'hello', false); };127 expect(testFn).to.not.throw(Error);128 });129 130 it('closePageError:click does not throw', function () {131 var factory = new UtilitiesFactory();132 var testFn = function () { factory.displayPageError('Users', 'hello', true); };133 expect(testFn).to.not.throw(Error);134 expect(function(){ $('.closePageError').click(); }).to.not.throw();135 });136 });137 138 describe('#handleGlobalError', function () {139 it('does not throw with status=200', function () {140 var factory = new UtilitiesFactory();141 var response = {142 status: 200,143 data: 'ohai'144 };145 var _defaultMessage = 'hello';146 var testFn = function () { factory.handleGlobalError(response, _defaultMessage); };147 expect(testFn).to.not.throw(Error);148 });149 150 it('does not throw with status=400', function () {151 var factory = new UtilitiesFactory();152 var response = {153 status: 400,154 data: {155 error:156 {157 message: 'hello'158 }159 }160 };161 var _defaultMessage = 'hello';162 var testFn = function () { factory.handleGlobalError(response, _defaultMessage); };163 expect(testFn).to.not.throw(Error);164 });165 166 it('does not throw with status=401', function () {167 var factory = new UtilitiesFactory();168 var response = {169 status: 401,170 data: {171 errors: {172 error: [173 {174 detail: 'hello'175 }176 ]177 }178 }179 };180 var _defaultMessage = 'hello';181 var testFn = function () { factory.handleGlobalError(response, _defaultMessage); };182 expect(testFn).to.not.throw(Error);183 });184 });185 describe('#extractErrorFromResponse', function () {186 it('does not throw with status=400 with non unique constraint violation', function () {187 var factory = new UtilitiesFactory();188 var response = {189 status: 400,190 data: {191 error:192 {193 message: 'hello'194 }195 }196 };197 var testFn = function () { factory.extractErrorFromResponse(response); };198 expect(testFn).to.not.throw(Error);199 });200 201 it('does not throw with status=400 with unique constraint violation', function () {202 var factory = new UtilitiesFactory();203 var response = {204 status: 400,205 data: {206 error:207 {208 message: 'unique constraint violation'209 }210 }211 };212 var testFn = function () { factory.extractErrorFromResponse(response); };213 expect(testFn).to.not.throw(Error);214 expect(factory.extractErrorFromResponse(response)).to.eql('nonUnique');215 });216 it('does not throw with status=401', function () {217 var factory = new UtilitiesFactory();218 var response = {219 status: 401,220 data: {221 errors: {222 error: [223 {224 detail: 'hello'225 }226 ]227 }228 }229 };230 var testFn = function () { factory.extractErrorFromResponse(response); };231 expect(testFn).to.not.throw(Error);232 });233 234 it('does not throw with status=200', function () {235 var factory = new UtilitiesFactory();236 var response = {237 status: 200,238 data: {239 errors: {240 error: [241 {242 detail: 'hello'243 }244 ]245 }246 }247 };248 var testFn = function () { factory.extractErrorFromResponse(response); };249 expect(testFn).to.not.throw(Error);250 });251 });252 describe('#failIfTokenExpired', function () {253 it('does not throw with modal test', function () {254 var factory = new UtilitiesFactory();255 var modal = {256 close: sinon.spy()257 };258 var testFn = function () { factory.failIfTokenExpired(modal); };259 expect(testFn).to.not.throw(Error);260 expect(modal.close.calledOnce).to.exist;261 });262 });263 264 describe('#trackEvent', function () {265 it('does not throw', function () {266 var factory = new UtilitiesFactory();267 var parm = {268 key: 'hello',269 value: 'angularjs'270 };271 var testFn = function () { factory.trackEvent('karma test', parm, parm, parm, parm); };272 expect(testFn).to.not.throw(Error);273 });274 });275 276 describe('#formatApplicationList', function () {277 it('does not throw', function () {278 var factory = new UtilitiesFactory();279 var apps = [280 {281 label: 'Angularjs'282 },283 {284 label: 'Angularjs2'285 }286 ];287 var testFn = function () { factory.formatApplicationList(apps); };288 expect(testFn).to.not.throw(Error);289 });290 });291 292 describe('#filterAppsForUser', function () {293 it('does not throw', function () {294 var factory = new UtilitiesFactory();295 var apps = [296 {297 label: 'Angularjs'298 },299 {300 label: 'Angularjs2'301 }302 ];303 var testFn = function () { factory.filterAppsForUser(apps, apps); };304 expect(testFn).to.not.throw(Error);305 });306 });307 308 describe('#hasPermission', function () {309 // var SessionFactory = new Session();310 // var sessionInfo = {311 // userID: 'angular',312 // accessToken: '12345',313 // tokenType: 'random',314 // userRole: 'ADMIN',315 // isSuperadmin: true,316 // permissions: ['ADMIN']317 // };318 // var session = SessionFactory.create(sessionInfo);319 320 it('does not throw', function () {321 var factory = new UtilitiesFactory();322 var testFn = function () { factory.hasPermission('test', 'ADMIN'); };323 expect(testFn).to.not.throw(Error);324 // TODO(van): this currently does not work properly325 });326 });327 328 describe('#hasAdmin', function () {329 330 it('does not throw', function () {331 var factory = new UtilitiesFactory();332 var perms = [333 {334 permissions: ['ADMIN']335 }336 ];337 var testFn = function () { factory.hasAdmin(perms); };338 expect(testFn).to.not.throw(Error);339 // TODO(van): this currently does not work properly340 });341 });342 343 describe('#getAppsWithAnyPermissions', function () {344 345 it('does not throw', function () {346 var factory = new UtilitiesFactory();347 var testFn = function () { factory.getAppsWithAnyPermissions(); };348 expect(testFn).to.not.throw(Error);349 });350 351 it('should return empty array with no apps/session', function () {352 var factory = new UtilitiesFactory();353 var testFn = function () { factory.getAppsWithAnyPermissions(); };354 expect(testFn).to.not.throw(Error);355 expect(factory.getAppsWithAnyPermissions()).to.eql([]);356 });357 });358 359 360 describe('#userHasRole', function () {361 362 it('should return true with READWRITE role and privName=write', function () {363 var factory = new UtilitiesFactory();364 var user = {365 applications: [366 {367 role: 'READWRITE'368 }369 ]370 };371 var privName = 'write';372 var testFn = function () { factory.userHasRole(user, privName); };373 expect(testFn).to.not.throw(Error);374 expect(factory.userHasRole(user, privName)).to.be.true;375 });376 377 it('should return true with ADMIN role and privName=write', function () {378 var factory = new UtilitiesFactory();379 var user = {380 applications: [381 {382 role: 'ADMIN'383 }384 ]385 };386 var privName = 'write';387 var testFn = function () { factory.userHasRole(user, privName); };388 expect(testFn).to.not.throw(Error);389 expect(factory.userHasRole(user, privName)).to.be.true;390 });391 392 it('should return true with ADMIN role and privName=write', function () {393 var factory = new UtilitiesFactory();394 var user = {395 applications: [396 {397 role: 'ADMIN'398 }399 ]400 };401 var privName = 'admin';402 var testFn = function () { factory.userHasRole(user, privName); };403 expect(testFn).to.not.throw(Error);404 expect(factory.userHasRole(user, privName)).to.be.true;405 });406 });407 describe('#userHasRoleForApplication', function () {408 409 it('should return true with ADMIN role and privName=admin', function () {410 var factory = new UtilitiesFactory();411 var appName = 'hello';412 var user = {413 applications: [414 {415 label: appName,416 role: 'ADMIN'417 }418 ]419 };420 var privName = 'admin';421 var testFn = function () { factory.userHasRoleForApplication(user, appName, privName); };422 expect(testFn).to.not.throw(Error);423 expect(factory.userHasRoleForApplication(user, appName, privName)).to.be.true;424 });425 426 it('should return true with ADMIN role and privName=write', function () {427 var factory = new UtilitiesFactory();428 var appName = 'hello';429 var user = {430 applications: [431 {432 label: appName,433 role: 'ADMIN'434 }435 ]436 };437 var privName = 'write';438 var testFn = function () { factory.userHasRoleForApplication(user, appName, privName); };439 expect(testFn).to.not.throw(Error);440 expect(factory.userHasRoleForApplication(user, appName, privName)).to.be.true;441 });442 });443 describe('#sortByHeadingValue', function () {444 445 it('should sort by admin', function () {446 var factory = new UtilitiesFactory();447 var items = [448 {449 label: 'angularjs',450 application: 'test',451 role: 'ADMIN'452 }453 ];454 var orderBy = 'admin';455 var reverse = false;456 var testFn = function () { factory.sortByHeadingValue(items, orderBy, reverse); };457 expect(testFn).to.not.throw(Error);458 expect(factory.sortByHeadingValue(items, orderBy, reverse).length).to.eql(items.length);459 });460 461 it('should sort by applications', function () {462 var factory = new UtilitiesFactory();463 var items = [464 {465 label: 'angularjs',466 application: 'test',467 role: 'ADMIN'468 }469 ];470 var orderBy = 'applications';471 var reverse = false;472 var testFn = function () { factory.sortByHeadingValue(items, orderBy, reverse); };473 expect(testFn).to.not.throw(Error);474 expect(factory.sortByHeadingValue(items, orderBy, reverse).length).to.eql(items.length);475 });476 });477 describe('#actionRate', function () {478 479 it('should respond properly with an actual Number', function () {480 var factory = new UtilitiesFactory();481 var label = 'test';482 var _input = 0.2;483 var _output = 20;484 var buckets = {485 'test': {486 jointActionRate: {487 estimate: _input488 }489 }490 };491 var testFn = function () { factory.actionRate(label, buckets); };492 expect(testFn).to.not.throw(Error);493 expect(factory.actionRate(label, buckets)).to.eql(_output);494 });495 496 it('should respond properly with NaNs', function () {497 var factory = new UtilitiesFactory();498 var label = 'test';499 var buckets = {500 'test': {501 jointActionRate: {502 estimate: 'test'503 }504 }505 };506 var testFn = function () { factory.actionRate(label, buckets); };507 expect(testFn).to.not.throw(Error);508 expect(factory.actionRate(label, buckets)).to.eql(0);509 });510 });511 describe('#actionDiff', function () {512 513 it('should respond properly with an actual Number', function () {514 var factory = new UtilitiesFactory();515 var label = 'test';516 var _input = 0.2;517 var _output = 20;518 var buckets = {519 'test': {520 jointActionRate: {521 estimate: _input522 }523 }524 };525 var testFn = function () { factory.actionDiff(label, buckets); };526 expect(testFn).to.not.throw(Error);527 expect(factory.actionRate(label, buckets)).to.eql(_output);528 });529 530 it('should respond properly with NaNs', function () {531 var factory = new UtilitiesFactory();532 var label = 'test';533 var buckets = {534 'test': {535 jointActionRate: {536 estimate: 'test'537 }538 }539 };540 var testFn = function () { factory.actionDiff(label, buckets); };541 expect(testFn).to.not.throw(Error);542 expect(factory.actionDiff(label, buckets)).to.eql(0);543 });544 });545 describe('#actionRate', function () {546 547 it('should respond properly with an actual Number', function () {548 var factory = new UtilitiesFactory();549 var label = 'test';550 var _input = 0.2;551 var _output = 20;552 var buckets = {553 'test': {554 jointActionRate: {555 estimate: _input556 }557 }558 };559 var testFn = function () { factory.actionRate(label, buckets); };560 expect(testFn).to.not.throw(Error);561 expect(factory.actionRate(label, buckets)).to.eql(_output);562 });563 564 it('should respond properly with NaNs', function () {565 var factory = new UtilitiesFactory();566 var label = 'test';567 var buckets = {568 'test': {569 jointActionRate: {570 estimate: 'test'571 }572 }573 };574 var testFn = function () { factory.actionRate(label, buckets); };575 expect(testFn).to.not.throw(Error);576 expect(factory.actionRate(label, buckets)).to.eql(0);577 });578 });579 describe('#saveFavorite', function () {580 581 it('should not throw when passed in simple inputs', function () {582 var factory = new UtilitiesFactory();583 var app = 'test';584 var experiment = 'angular';585 var testFn = function () { factory.saveFavorite(app, experiment); };586 expect(testFn).to.not.throw(Error);587 });588 });589 590 describe('#removeFavorite', function () {591 592 it('should not throw when passed in simple inputs', function () {593 var factory = new UtilitiesFactory();594 var app = 'test';595 var experiment = 'angular';596 var testFn = function () { factory.removeFavorite(app, experiment); };597 expect(testFn).to.not.throw(Error);598 });599 });600 601 describe('#retrieveFavorites', function () {602 603 it('should not throw when passed in simple inputs', function () {604 var factory = new UtilitiesFactory();605 var testFn = function () { factory.retrieveFavorites(); };606 expect(testFn).to.not.throw(Error);607 });608 });609 610 describe('#getBucket', function () {611 612 it('should not throw when bucket label is found', function () {613 var factory = new UtilitiesFactory();614 var label = 'test';615 var experiment = {616 buckets: [617 {618 label: label619 }620 ]621 };622 var testFn = function () { factory.getBucket(label, experiment); };623 expect(testFn).to.not.throw(Error);624 });625 626 it('should not throw when bucket label is not found', function () {627 var factory = new UtilitiesFactory();628 var label = 'test';629 var experiment = {630 buckets: [631 {632 label: 'label'633 }634 ]635 };636 var testFn = function () { factory.getBucket(label, experiment); };637 expect(testFn).to.not.throw(Error);638 });639 640 it('should not throw when `experiments` is not found', function () {641 var factory = new UtilitiesFactory();642 var label = 'test';643 var testFn = function () { factory.getBucket(label); };644 expect(testFn).to.not.throw(Error);645 });646 });647 describe('#getFormattedStartAndEndDates', function () {648 649 it('should not throw when passed in simple inputs', function () {650 var factory = new UtilitiesFactory();651 var ts = Date.now();652 var experiment = {653 startTime: new Date(ts - 10000000),654 endTime: new Date(ts - 10000)655 };656 var testFn = function () { factory.getFormattedStartAndEndDates(experiment); };657 expect(testFn).to.not.throw(Error);658 });659 });660 661 describe('#determineBucketImprovementClass', function () {662 var testBucket = {663 label: 'test',664 homePageTooltip: 'test',665 jointActionRate: {666 estimate: 1667 }668 };669 var ctrlBucket = {670 label: 'control',671 homePageTooltip: 'control',672 jointActionRate: {673 estimate: 0.5674 }675 };676 677 it('should not throw when passed in simple inputs', function () {678 var factory = new UtilitiesFactory();679 680 var experiment = {681 progress: 100,682 statistics: {683 buckets: {684 'test': testBucket,685 'control': ctrlBucket686 },687 jointProgress: {688 winnersSoFar: ['test'],689 losersSoFar: ['control']690 },691 },692 buckets: [693 testBucket, ctrlBucket694 ]695 };696 var label = 'control';697 var testFn = function () { factory.determineBucketImprovementClass(experiment, label); };698 expect(testFn).to.not.throw(Error);699 });700 701 it('should not throw when no winners so far', function () {702 var factory = new UtilitiesFactory();703 704 var experiment = {705 progress: 100,706 statistics: {707 buckets: {708 'test': testBucket,709 'control': ctrlBucket710 },711 jointProgress: {712 losersSoFar: ['control']713 },714 },715 buckets: [716 testBucket, ctrlBucket717 ]718 };719 var label = 'control';720 var testFn = function () { factory.determineBucketImprovementClass(experiment, label); };721 expect(testFn).to.not.throw(Error);722 });723 });...
ExperimentsCtrl.js
Source:ExperimentsCtrl.js
1'use strict';2describe('ExperimentsCtrl', function () {3 var scope, $location, createController, $httpBackend;4 5 beforeEach(module('wasabi', 'ui.router', 'wasabi.controllers'));6 beforeEach(inject(function($rootScope, $controller, _$location_){7 $location = _$location_;8 scope = $rootScope.$new();9 10 angular.mock.inject(function($injector){11 $httpBackend = $injector.get('$httpBackend');12 });13 14 createController = function () {15 return $controller('ExperimentsCtrl', {16 '$scope': scope17 });18 };19 }));20 21 describe('Constructor', function () {22 it('should not throw and should generate known scope keys', function () {23 createController();24 var keys = ['data', 'orderByField', 'reverseSort', 'itemsPerPage', 'pagedData', 'groupedItems', 'filteredItems', 'currentPage', 'totalItems', 'hasAnyCreatePermissions', 'experiment', 'applications', 'loadExperiments', 'applySearchSortFilters', 'deleteExperiment', 'changeState', 'stateImgUrl', 'stateName', 'capitalizeFirstLetter', 'hasPermission', 'sortBy', 'search', 'advSearch', 'pageChanged', 'pageRangeStart', 'pageRangeEnd', 'filterList', 'advancedFilterList', 'refreshSearch', 'refreshAdvSearch', 'showMoreLessSearch', 'hasDeletePermission', 'hasUpdatePermission', 'openExperimentModal'];25 keys.forEach(function(d){26 expect(scope[d]).to.exist;27 });28 });29 });30 31 describe('#loadExperiments', function () {32 it('should not throw ', function () {33 createController();34 var orderbyField = 'id';35 var testFn = function () {36 scope.loadExperiments(orderbyField);37 };38 expect(testFn).to.not.throw();39 });40 });41 42 describe('#search', function () {43 it('should not throw on defined scope.data.query', function () {44 createController();45 var testFn = function () {46 scope.search('angularjs');47 };48 scope.data.query = '2';49 scope.experiments = [50 {51 label: 'angularjs',52 id: 1,53 percent: '2',54 state: 'DRAFT'55 }56 ];57 expect(testFn).to.not.throw();58 });59 60 it('should not throw on empty string scope.data.query', function () {61 createController();62 var testFn = function () {63 scope.search('angularjs');64 };65 scope.data.query = '';66 scope.experiments = [67 {68 label: 'angularjs',69 id: 1,70 state: 'DRAFT'71 }72 ];73 expect(testFn).to.not.throw();74 });75 });76 describe('#advSearch', function () {77 it('should not throw', function () {78 createController();79 var testFn = function () {80 scope.advSearch('angularjs');81 };82 scope.data.query = '2';83 scope.data.advStatus = 'ohai';84 scope.experiments = [85 {86 label: 'angularjs',87 applicationName: 'angularjs',88 id: 1,89 state: 'CLOSED',90 percent: '2'91 }92 ];93 expect(testFn).to.not.throw();94 });95 96 it('should not throw with null input', function () {97 createController();98 var testFn = function () {99 scope.advSearch();100 };101 scope.data.query = '2';102 scope.data.advStatus = 'ohai';103 scope.experiments = [104 {105 label: 'angularjs',106 applicationName: 'angularjs',107 id: 1,108 state: 'CLOSED',109 percent: '2'110 }111 ];112 expect(testFn).to.not.throw();113 });114 115 it('should set advApplicationName if null', function () {116 createController();117 var testFn = function () {118 scope.advSearch('angularjs');119 };120 scope.data.query = '2';121 scope.data.advStatus = 'ohai';122 scope.data.advApplicationName = null;123 scope.experiments = [124 {125 label: 'angularjs',126 applicationName: 'angularjs',127 id: 1,128 state: 'CLOSED',129 percent: '2'130 }131 ];132 expect(testFn).to.not.throw();133 expect(scope.data.advApplicationName).to.eql('');134 });135 136 it('should handle adv1stDateSearchType types', function () {137 createController();138 139 var _types = ['isBefore', 'isOn', 'isAfter', 'isBetween'];140 _types.forEach(function(d){141 142 scope.data.adv1stDateSearchType = d;143 var testFn = function () {144 scope.advSearch('angularjs');145 };146 scope.data.query = '2';147 scope.data.advStatus = 'ohai';148 scope.data.advApplicationName = null;149 scope.experiments = [150 {151 label: 'angularjs',152 applicationName: 'angularjs',153 id: 1,154 state: 'CLOSED',155 percent: '2'156 }157 ];158 expect(testFn).to.not.throw();159 expect(scope.data.advApplicationName).to.eql('');160 });161 });162 });163 describe('#pageChanged', function () {164 it('should not throw', function () {165 createController();166 var testFn = function () {167 scope.pageChanged();168 };169 expect(testFn).to.not.throw();170 });171 });172 173 describe('#pageRangeStart', function () {174 it('should not throw', function () {175 createController();176 var testFn = function () {177 scope.pageRangeStart();178 };179 expect(testFn).to.not.throw();180 });181 });182 183 describe('#pageRangeEnd', function () {184 it('should not throw', function () {185 createController();186 var testFn = function () {187 scope.pageRangeEnd();188 };189 expect(testFn).to.not.throw();190 });191 });192 193 describe('#deleteExperiment', function () {194 it('should not throw', function () {195 createController();196 var testFn = function () {197 var exp = {198 applicationName: 'angularjs',199 label: 'angularjs',200 id: 1201 };202 scope.deleteExperiment(exp);203 };204 expect(testFn).to.not.throw();205 });206 });207 208 describe('#stateImgUrl', function () {209 it('should not throw', function () {210 createController();211 var testFn = function () {212 scope.stateImgUrl('CLOSED');213 };214 expect(testFn).to.not.throw();215 });216 });217 218 describe('#stateName', function () {219 it('should not throw', function () {220 createController();221 var testFn = function () {222 scope.stateName('CLOSED');223 };224 expect(testFn).to.not.throw();225 });226 });227 228 describe('#capitalizeFirstLetter', function () {229 it('should not throw', function () {230 createController();231 var testFn = function () {232 scope.capitalizeFirstLetter('angularjs');233 };234 expect(testFn).to.not.throw();235 expect(scope.capitalizeFirstLetter('angularjs')).to.eql('Angularjs');236 });237 });238 239 describe('#hasPermission', function () {240 it('should not throw', function () {241 createController();242 var testFn = function () {243 scope.hasPermission('angluarjs', 'ADMIN');244 };245 expect(testFn).to.not.throw();246 });247 });248 249 describe('#sortBy', function () {250 it('should not throw', function () {251 createController();252 scope.data.query = '2';253 scope.data.advStatus = 'ohai';254 scope.data.advApplicationName = null;255 scope.experiments = [256 {257 label: 'angularjs',258 applicationName: 'angularjs',259 id: 1,260 state: 'CLOSED',261 percent: '2'262 }263 ];264 var testFn = function () {265 scope.sortBy('label', false);266 };267 expect(testFn).to.not.throw();268 });269 270 it('should not throw on matching orderByField', function () {271 createController();272 scope.data.query = '2';273 scope.data.advStatus = 'ohai';274 scope.data.advApplicationName = null;275 scope.experiments = [276 {277 label: 'angularjs',278 applicationName: 'angularjs',279 id: 1,280 state: 'CLOSED',281 percent: '2'282 }283 ];284 scope.orderByField = 'label';285 var testFn = function () {286 scope.sortBy(scope.orderByField, false);287 };288 expect(testFn).to.not.throw();289 });290 291 it('should not throw on reverseSort', function () {292 createController();293 scope.data.query = '2';294 scope.data.advStatus = 'ohai';295 scope.data.advApplicationName = null;296 scope.experiments = [297 {298 label: 'angularjs',299 applicationName: 'angularjs',300 id: 1,301 state: 'CLOSED',302 percent: '2'303 }304 ];305 scope.orderByField = 'label';306 var testFn = function () {307 scope.sortBy(scope.orderByField, true);308 };309 expect(testFn).to.not.throw();310 });311 });312 describe('#hasDeletePermission', function () {313 it('should not throw', function () {314 createController();315 var testFn = function () {316 scope.hasDeletePermission('angluarjs');317 };318 expect(testFn).to.not.throw();319 });320 });321 322 describe('#hasUpdatePermission', function () {323 it('should not throw', function () {324 createController();325 var testFn = function () {326 scope.hasDeletePermission('angluarjs');327 };328 expect(testFn).to.not.throw();329 });330 });331 332 describe('#openExperimentModal', function () {333 it('should not throw', function () {334 createController();335 var testFn = function () {336 scope.openExperimentModal('angluarjs');337 };338 expect(testFn).to.not.throw();339 });340 });...
PagesCtrl.js
Source:PagesCtrl.js
1'use strict';2describe('PagesCtrl', function () {3 var scope, createController, modal,4 mockDialogsFactory = {5 alertDialog: function(content, title, doneFunc) {6 doneFunc();7 },8 confirmDialog: function(content, title, doneFunc) {9 doneFunc();10 }11 },mockApplicationsFactory = {12 getPages: function(options) {13 return {14 $promise: {15 then: function(doneFunc) {16 doneFunc([{17 name: 'myGlobalPage'18 }]);19 }20 }21 };22 }23 },24 mockExperimentsFactory = {25 getPages: function(options) {26 return {27 $promise: {28 then: function(doneFunc) {29 doneFunc([]);30 }31 }32 };33 },34 savePages: function(options) {35 return {36 $promise: {37 then: function() {}38 }39 };40 },41 removePage: function(options) {42 return {43 $promise: {44 then: function() {}45 }46 };47 }48 };49 50 beforeEach(function() {51 module('wasabi', 'ui.router', 'wasabi.controllers');52 module({53 DialogsFactory: mockDialogsFactory,54 ExperimentsFactory: mockExperimentsFactory,55 ApplicationsFactory: mockApplicationsFactory56 });57 });58 beforeEach(inject(function($rootScope, $controller){59 scope = $rootScope.$new();60 61 modal = {62 close: sinon.stub(),63 dismiss: sinon.stub()64 };65 66 scope.experiment = {67 id: 168 };69 70 createController = function () {71 return $controller('PagesCtrl', {72 '$scope': scope,73 '$modalInstance': modal,74 'pages': []75 });76 };77 }));78 79 80/*81 describe('Constructor', function () {82 it('should exist and bind some keys to scope', function () {83 createController();84 var keys = ['pages', 'pagesData', 'loadPages', 'loadGlobalPages', 'initPages', 'doSavePages', 'updatePage', 'selectPage', 'validateAndAddPage', 'selectPageOnEnter', 'addPageClick', 'removePage', 'addPageToList'];85 86 keys.forEach(function(d){87 expect(scope[d]).to.not.be.undefined;88 });89 });90 });91 92 describe('#loadPages', function () {93 it('should not throw', function () {94 createController();95 var testFn = function () {96 scope.loadPages();97 };98 expect(testFn).to.not.throw();99 });100 });101 102 describe('#loadGlobalPages', function () {103 it('should not throw', function () {104 createController();105 var testFn = function () {106 scope.loadGlobalPages();107 };108 expect(testFn).to.not.throw();109 });110 it('should not throw when applicationName', function () {111 createController();112 scope.experiment.applicationName = 'CTG';113 var testFn = function () {114 scope.loadGlobalPages();115 };116 expect(testFn).to.not.throw();117 });118 });119 120 describe('#initPages', function () {121 it('should not throw', function () {122 createController();123 var testFn = function () {124 scope.pages = [125 {126 name: 'angularjs'127 }128 ];129 scope.initPages();130 };131 expect(testFn).to.not.throw();132 });133 });134 135 describe('#doSavePages', function () {136 it('should not throw', function () {137 createController();138 var testFn = function () {139 scope.pages = [140 {141 name: 'angularjs'142 }143 ];144 scope.doSavePages('angularjs');145 };146 expect(testFn).to.not.throw();147 });148 });149 150 describe('#updatePage', function () {151 it('should not throw', function () {152 createController();153 var testFn = function () {154 var page = {155 name: 'angularjs',156 allowNewAssignment: false157 };158 scope.updatePage(page);159 };160 expect(testFn).to.not.throw();161 });162 });163 164 describe('#validateAndAddPage', function () {165 it('should not throw', function () {166 createController();167 var testFn = function () {168 scope.pages = [169 {170 name: 'angularjs'171 }172 ];173 scope.validateAndAddPage('angularjs');174 };175 expect(testFn).to.not.throw();176 });177 178 it('should not throw with no pages', function () {179 createController();180 var testFn = function () {181 scope.validateAndAddPage('angularjs');182 };183 expect(testFn).to.not.throw();184 });185 186 it('should return false if not matching syntax', function () {187 createController();188 var testFn = function () {189 expect(scope.validateAndAddPage('1angularjs')).to.be.undefined;190 };191 expect(testFn).to.not.throw();192 });193 });194 195 describe('#addPageClick', function () {196 it('should not throw', function () {197 createController();198 var testFn = function () {199 scope.addPageClick();200 };201 expect(testFn).to.not.throw();202 });203 });204 205 describe('#removePage', function () {206 it('should not throw', function () {207 createController();208 var testFn = function () {209 scope.removePage();210 };211 expect(testFn).to.not.throw();212 });213 it('should not throw when page name not empty', function () {214 createController();215 scope.pages = [];216 var testFn = function () {217 scope.removePage('myPage');218 };219 expect(testFn).to.not.throw();220 });221 it('should not throw when page name not empty and pages array not empty, but no match', function () {222 createController();223 scope.pages = [{224 name: 'mypage2'225 }];226 var testFn = function () {227 scope.removePage('myPage');228 };229 expect(testFn).to.not.throw();230 });231 it('should not throw when page name not empty and pages array not empty, and find match', function () {232 createController();233 scope.pages = [{234 name: 'myPage'235 }];236 var testFn = function () {237 scope.removePage('myPage');238 };239 expect(testFn).to.not.throw();240 });241 });242 243 describe('#addPageToList', function () {244 it('should not throw', function () {245 createController();246 var testFn = function () {247 scope.addPageToList();248 };249 expect(testFn).to.not.throw();250 });251 });252 describe('#selectPage', function () {253 it('should not throw', function () {254 createController();255 var testFn = function () {256 var event = {},257 ui = {258 item: {259 label: 'test'260 }261 }262 scope.selectPage(event, ui);263 };264 expect(testFn).to.not.throw();265 });266 });267 describe('#selectPageOnEnter', function () {268 it('should not throw, addingPage true', function () {269 createController();270 scope.addingPage = true;271 var testFn = function () {272 scope.selectPageOnEnter();273 };274 expect(testFn).to.not.throw();275 });276 it('should not throw, addingPage false', function () {277 createController();278 scope.addingPage = false;279 var testFn = function () {280 scope.selectPageOnEnter('myPage');281 };282 expect(testFn).to.not.throw();283 });284 it('should not throw, addingPage false, new page', function () {285 createController();286 scope.addingPage = false;287 scope.pagesData.groupPages.push('bogus');288 var testFn = function () {289 scope.selectPageOnEnter('myPage');290 };291 expect(testFn).to.not.throw();292 });293 it('should not throw, addingPage false, existing page', function () {294 createController();295 scope.addingPage = false;296 scope.pagesData.groupPages.push('myPage');297 var testFn = function () {298 scope.selectPageOnEnter('myPage');299 };300 expect(testFn).to.not.throw();301 });302 });303*/...
utils.js
Source:utils.js
...49 // SYNC TESTS50 else if (!isTestAsync(testFn) && isGenerator(beforeFn)) {51 exports[name] = function*(assert) {52 yield Task.spawn(beforeFn.bind(null, name, assert));53 testFn(assert);54 };55 }56 else if (!isTestAsync(testFn) && !isHelperAsync(beforeFn)) {57 exports[name] = function (assert) {58 beforeFn(name, assert);59 testFn(assert);60 };61 }62 else if (!isTestAsync(testFn) && isHelperAsync(beforeFn)) {63 exports[name] = function (assert, done) {64 beforeFn(name, assert, () => {65 testFn(assert);66 done();67 });68 };69 }70 // ASYNC TESTS71 else if (isTestAsync(testFn) && isGenerator(beforeFn)) {72 exports[name] = function*(assert) {73 yield Task.spawn(beforeFn.bind(null, name, assert));74 yield new Promise(resolve => testFn(assert, resolve));75 };76 }77 else if (isTestAsync(testFn) && !isHelperAsync(beforeFn)) {78 exports[name] = function (assert, done) {79 beforeFn(name, assert);80 testFn(assert, done);81 };82 }83 else if (isTestAsync(testFn) && isHelperAsync(beforeFn)) {84 exports[name] = function (assert, done) {85 beforeFn(name, assert, () => {86 testFn(assert, done);87 });88 };89 }90 });91}92exports.before = before;93/*94 * Takes an `exports` object of a test file and a function `afterFn`95 * to be run after each test. `afterFn` is called with a `name` string96 * as the first argument of the test name, and may specify a second97 * argument function `done` to indicate that this function should98 * resolve asynchronously99 */100function after (exports, afterFn) {101 getTestNames(exports).map(name => {102 let testFn = exports[name];103 // GENERATOR TESTS104 if (isGenerator(testFn) && isGenerator(afterFn)) {105 exports[name] = function*(assert) {106 yield Task.spawn(testFn.bind(null, assert));107 yield Task.spawn(afterFn.bind(null, name, assert));108 }109 }110 else if (isGenerator(testFn) && !isHelperAsync(afterFn)) {111 exports[name] = function*(assert) {112 yield Task.spawn(testFn.bind(null, assert));113 afterFn(name, assert);114 }115 }116 else if (isGenerator(testFn) && isHelperAsync(afterFn)) {117 exports[name] = function*(assert) {118 yield Task.spawn(testFn.bind(null, assert));119 yield new Promise(resolve => afterFn(name, assert, resolve));120 }121 }122 // SYNC TESTS123 else if (!isTestAsync(testFn) && isGenerator(afterFn)) {124 exports[name] = function*(assert) {125 testFn(assert);126 yield Task.spawn(afterFn.bind(null, name, assert));127 };128 }129 else if (!isTestAsync(testFn) && !isHelperAsync(afterFn)) {130 exports[name] = function (assert) {131 testFn(assert);132 afterFn(name, assert);133 };134 }135 else if (!isTestAsync(testFn) && isHelperAsync(afterFn)) {136 exports[name] = function (assert, done) {137 testFn(assert);138 afterFn(name, assert, done);139 };140 }141 // ASYNC TESTS142 else if (isTestAsync(testFn) && isGenerator(afterFn)) {143 exports[name] = function*(assert) {144 yield new Promise(resolve => testFn(assert, resolve));145 yield Task.spawn(afterFn.bind(null, name, assert));146 };147 }148 else if (isTestAsync(testFn) && !isHelperAsync(afterFn)) {149 exports[name] = function*(assert) {150 yield new Promise(resolve => testFn(assert, resolve));151 afterFn(name, assert);152 };153 }154 else if (isTestAsync(testFn) && isHelperAsync(afterFn)) {155 exports[name] = function*(assert) {156 yield new Promise(resolve => testFn(assert, resolve));157 yield new Promise(resolve => afterFn(name, assert, resolve));158 };159 }160 });161}162exports.after = after;163function waitUntil (predicate, delay) {164 let { promise, resolve } = defer();165 let interval = setInterval(() => {166 if (!predicate()) return;167 clearInterval(interval);168 resolve();169 }, delay || 10);170 return promise;...
jfp-tests.ts
Source:jfp-tests.ts
1/// <reference path="jfp.d.ts" />2function testFn () {};3j(testFn);4j.add(5, 6);5j.always(true)();6j.and(true, false) === false;7j.apply(testFn, [1, 2, 3]);8j.between([3, 7], 5) === true;9j.call(testFn, 1, 2, 3);10j.clone({});11j.compact([]);12j.compose(testFn, testFn)();13j.composePredicate(j.isZero)(0);14j.concat([], []);15j.conj('foo', []);16j.cons('foo', []);17j.contains('foo', []);18j.copyArray([]);19j.countArguments(testFn);20j.curry(testFn);21j.deref('foo.bar.baz', {});22j.difference([], []);23j.divide(6, 3);24j.drop(0, [1, 2, 3]);25j.dropFirst([1, 2, 3]);26j.dropLast([1, 2, 3]);27j.dropUntil(j.isZero, []);28j.fac(5);29j.filter(j.isEven, [1, 2, 3, 4, 5]);30j.find(j.isEven, []);31j.first([1, 2, 3]);32j.hasFirst([]);33j.identity(5);34j.inc(5);35j.init([]);36j.intersect([], []);37j.isArray([]);38j.isBoolean(true);39j.isEmptyString('bar');40j.isEven(3);41j.isFunction(testFn);42j.isInt(9.2);43j.isMultipleOf(5, 35);44j.isNegative(938);45j.isNonNegative(3);46j.isNonPositive(-99);47j.isNonZero(0);48j.isNull('not null');49j.isNumber({});50j.isNumeric('5.78');51j.isObject({});52j.isOdd(6);53j.isPair([]);54j.isPositive(9);55j.isPrimitive({});56j.isSingle([]);57j.isString('Yup');58j.isTriple([1, 2, 3]);59j.isTruthy(1);60j.isTuple([]);61j.isType('number', 5);62j.isUndefined(undefined);63j.isZero(100);64j.last([1, 2, 3]);65j.lastIndex([]);66j.leq(0, 6);67j.less(9, 10);68j.map(j.partial(j.add, 1), [1, 2, 3]);69j.max(5, 6);70j.maybe(null);71j.maybeType('string', null);72j.merge([], []);73j.min(5, 6);74j.mod(4, 3);75j.modulo(4, 3);76j.multiPartition(j.equal, [1, 2], [1, 2, 1, 2]);77j.multiply(1, 2);78j.not(true);79j.nth(5, [1, 2, 3, 4, 5, 6, 7]);80j.numberOf(j.isEven, [1, 2, 3, 4]);81j.or(true, false);82j.partial(testFn, 'foo')();83j.partialReverse(testFn, 1, 2)();84j.partition(j.isEven, [1, 2, 3, 4]);85j.pick('foo', { foo: 'bar' });86j.pipeline('foo', testFn, testFn);87j.pluck('foo', { foo: 'bar' });88j.pluckKeys(['foo'], { foo: 'bar' });89j.range(5);90j.range(5, 7);91j.rcompose(testFn, testFn)();92j.recur(testFn, 1, 2, 3);93j.reduce(testFn, [1, 2, 3], []);94j.repeat(10, testFn);95j.rest([1, 2, 3, 4]);96j.reverseArgs(testFn)();97j.rpartial(testFn, 1, 2, 3);98j.shortCircuit('foo', testFn, 'bar');99j.slice(0, [1, 2, 3]);100j.slice(0, [1, 2, 3], 1);101j.some(j.isEven, [1, 2, 3]);102j.sort([1, 2, 3, 4], function () { return 0});103j.splitPartial(testFn, [], [])();104j.subtract(6, 5);105j.symmetricDifference([], []);106j.take(5, [1, 2, 3, 4, 5, 6]);107j.takeUntil(j.isEven, [1, 3, 5, 6, 7]);108j.times(10, 'foo');109j.toDec('10');110j.toValues({ foo: 'bar' });111j.transform([['foo', 'bar']], {});112j.truncate(5.7);113j.union([], []);114j.unique([]);115j.when(true, testFn);116j.xor(true, true);...
Using AI Code Generation
1var pact = require('pact-foundation-pact-node');2console.log(pact.testFn());3var pact = require('pact-foundation-pact-node');4console.log(pact.testFn());5var pact = require('pact-foundation-pact-node');6console.log(pact.testFn());7var pact = require('pact-foundation-pact-node');8console.log(pact.testFn());9var pact = require('pact-foundation-pact-node');10console.log(pact.testFn());11var pact = require('pact-foundation-pact-node');12console.log(pact.testFn());13var pact = require('pact-foundation-pact-node');14console.log(pact.testFn());15var pact = require('pact-foundation-pact-node');16console.log(pact.testFn());17var pact = require('pact-foundation-pact-node');18console.log(pact.testFn());19var pact = require('pact-foundation-pact-node');20console.log(pact.testFn());21var pact = require('pact-foundation-pact-node');22console.log(pact.testFn());23var pact = require('pact-foundation-pact-node');24console.log(pact.testFn());
Using AI Code Generation
1const pact = require('pact-foundation-pact');2const testFn = pact.testFn;3testFn();4const pact = require('pact-foundation-pact');5const testFn = pact.testFn;6testFn();7const pact = require('pact-foundation-pact');8const testFn = pact.testFn;9testFn();10const pact = require('pact-foundation-pact');11const testFn = pact.testFn;12testFn();13const pact = require('pact-foundation-pact');14const testFn = pact.testFn;15testFn();16const pact = require('pact-foundation-pact');17const testFn = pact.testFn;18testFn();19const pact = require('pact-foundation-pact');20const testFn = pact.testFn;21testFn();22const pact = require('pact-foundation-pact');23const testFn = pact.testFn;24testFn();25const pact = require('pact-foundation-pact');26const testFn = pact.testFn;27testFn();28const pact = require('pact-foundation-pact');29const testFn = pact.testFn;30testFn();31const pact = require('pact-foundation-pact');32const testFn = pact.testFn;33testFn();34const pact = require('pact-foundation-pact');
Using AI Code Generation
1const pact = require('pact-foundation/pact')2testFn()3const pactNode = require('pact-foundation/pact-node')4testFn()5const pactWeb = require('pact-foundation/pact-web')6testFn()7const pact = require('pact-foundation/pact')8testFn()9const pactNode = require('pact-foundation/pact-node')10testFn()11const pactWeb = require('pact-foundation/pact-web')12testFn()13const pactJs = require('pact-foundation/pact-js')14testFn()15import pact as pact_py16testFn()17import pact_node as pact_node_py18testFn()19import pact_web as pact_web_py20testFn()21import pact_js as pact_js_py22testFn()
Using AI Code Generation
1var pact = require('pact-foundation-pact');2var testFn = pact.testFn;3var testFn2 = pact.testFn2;4var testFn3 = pact.testFn3;5var pact = require('pact-foundation-pact');6var testFn = pact.testFn;7var testFn2 = pact.testFn2;8var testFn3 = pact.testFn3;9var pact = require('pact-foundation-pact');10var testFn = pact.testFn;11var testFn2 = pact.testFn2;12var testFn3 = pact.testFn3;13var pact = require('pact-foundation-pact');14var testFn = pact.testFn;15var testFn2 = pact.testFn2;16var testFn3 = pact.testFn3;17var pact = require('pact-foundation-pact');18var testFn = pact.testFn;19var testFn2 = pact.testFn2;20var testFn3 = pact.testFn3;21var pact = require('pact-foundation-pact');22var testFn = pact.testFn;23var testFn2 = pact.testFn2;24var testFn3 = pact.testFn3;25var pact = require('pact-foundation-pact');26var testFn = pact.testFn;27var testFn2 = pact.testFn2;28var testFn3 = pact.testFn3;29var pact = require('pact-foundation-pact');30var testFn = pact.testFn;31var testFn2 = pact.testFn2;32var testFn3 = pact.testFn3;33var pact = require('pact-foundation-pact');34var testFn = pact.testFn;35var testFn2 = pact.testFn2;36var testFn3 = pact.testFn3;37var pact = require('pact-foundation-pact');
Using AI Code Generation
1var pactNode = require('pact-foundation-pact-node');2pactNode.testFn();3var pactNode = require('./test2');4pactNode.testFn();5var pactNode = require('pact-foundation-pact-node');6pactNode.testFn();7var pactNode = require('./test2');8pactNode.testFn();9var pactNode = require('pact-foundation-pact-node');10pactNode.testFn();11var pactNode = require('./test2');12pactNode.testFn();13var pactNode = require('pact-foundation-pact-node');14pactNode.testFn();15var pactNode = require('./test2');16pactNode.testFn();17var pactNode = require('pact-foundation-pact-node');18pactNode.testFn();19var pactNode = require('./test2');20pactNode.testFn();21var pactNode = require('pact-foundation-pact-node');22pactNode.testFn();23var pactNode = require('./test2');24pactNode.testFn();25var pactNode = require('pact-foundation-pact-node');26pactNode.testFn();27var pactNode = require('./test2');28pactNode.testFn();29var pactNode = require('pact-foundation-pact-node');30pactNode.testFn();31var pactNode = require('./test2');32pactNode.testFn();
Learn to execute automation testing from scratch with LambdaTest Learning Hub. Right from setting up the prerequisites to run your first automation test, to following best practices and diving deeper into advanced test scenarios. LambdaTest Learning Hubs compile a list of step-by-step guides to help you be proficient with different test automation frameworks i.e. Selenium, Cypress, TestNG etc.
You could also refer to video tutorials over LambdaTest YouTube channel to get step by step demonstration from industry experts.
Get 100 minutes of automation test minutes FREE!!