From 4be1bbbdba07f5db40e50a93f21f13671976c59d Mon Sep 17 00:00:00 2001 From: Seyi Adebajo Date: Tue, 27 Mar 2018 08:39:17 -0700 Subject: [PATCH] updates failing tests --- .../components/dataset-aclaccess-test.js | 175 +----------------- .../containers/dataset-acl-access-test.js | 2 +- .../datasets/metadata-acquisition-test.js | 4 +- 3 files changed, 7 insertions(+), 174 deletions(-) diff --git a/wherehows-web/tests/integration/components/dataset-aclaccess-test.js b/wherehows-web/tests/integration/components/dataset-aclaccess-test.js index 4e3797b031..d8eff2b3d3 100644 --- a/wherehows-web/tests/integration/components/dataset-aclaccess-test.js +++ b/wherehows-web/tests/integration/components/dataset-aclaccess-test.js @@ -1,185 +1,18 @@ import { moduleForComponent, test } from 'ember-qunit'; import hbs from 'htmlbars-inline-precompile'; import { triggerEvent } from 'ember-native-dom-helpers'; -import { - accessInfoTesting as accessInfo, - approvedResponseTesting as approvedResponse -} from 'wherehows-web/mirage/helpers/aclauth'; moduleForComponent('dataset-aclaccess', 'Integration | Component | dataset aclaccess', { integration: true }); -//TODO: Define testing case -const currentUser = 'Mitchell_Rath'; -const accessResponse = { isApproved: false }; - -//TODO: test each part of the component loading situation test('it renders', function(assert) { this.setProperties({ - accessInfo: accessInfo(true), - currentUser + acls: [], + accessTypeDropDownOptions: [] }); - this.render(hbs`{{dataset-aclaccess accessInfo=accessInfo currentUser=currentUser}}`); + this.render(hbs`{{dataset-aclaccess acls=acls accessTypeDropDownOptions=accessTypeDropDownOptions}}`); - assert.ok(this.$(), 'Render without errors'); - - assert.ok(this.$('#acl-permissioninfo'), 'Render permission info section without errors'); - - assert.ok(this.$('#acl-permissionrequest'), 'Render permission request section without errors'); - - assert.ok(this.$('#acl-accessusers'), 'Render access users section without errors'); -}); - -test('component content renders correctly with permission', function(assert) { - this.setProperties({ - accessInfo: accessInfo(true), - currentUser - }); - - this.render(hbs`{{dataset-aclaccess accessInfo=accessInfo currentUser=currentUser}}`); - - assert.ok( - this.$('i[title="permission"]').attr('class', 'fa fa-check-circle-o fa-lg acl-permission__success'), - 'Render the icon is correctly with the permission' - ); - - assert.equal( - this.$('.acl-permission__meta') - .text() - .trim(), - 'Mitchell_Rath, you have access to this data', - 'Render the permission message' - ); - - assert.equal(this.$('.acl-table__header').text(), 'People with ACL Access', 'Render users list title correctly'); - - //table has 7 colums - assert.equal(this.$('td').length, 7, 'Render table header correctly'); -}); - -test('component content renders correctly without permission', function(assert) { - this.setProperties({ - accessInfo: accessInfo(false), - currentUser - }); - - this.render(hbs`{{dataset-aclaccess accessInfo=accessInfo currentUser=currentUser}}`); - - assert.ok( - this.$('i[title="permission"]').attr('class', 'fa fa-ban fa-lg acl-permission__reject'), - 'Render icon is correctly in permission info section' - ); - - assert.ok(this.$('.acl-form'), 'Render permission request section without errors'); - - assert.equal( - this.$('.acl-permission__meta') - .text() - .trim(), - 'Mitchell_Rath, you currently do not have access to this dataset', - 'Render permission message correctly' - ); - - assert.equal( - this.$('.acl-form__meta.acl-form__header') - .text() - .trim(), - 'Request Access', - 'Render request form title correctly' - ); - - assert.equal( - this.$('.acl-form__meta__header') - .text() - .trim(), - 'Why do you need access?', - 'Render request form subtitle 1 correctly' - ); - - assert.equal( - this.$('.acl-form__meta__content') - .text() - .trim(), - 'Please add business reason you need to access this data.', - 'Render request form subtitle 2 correctly' - ); -}); - -test('component content renders permission rejected', function(assert) { - this.setProperties({ - accessInfo: accessInfo(false), - currentUser, - accessResponse - }); - - this.render(hbs` - {{dataset-aclaccess - accessInfo=accessInfo - currentUser=currentUser - accessResponse=accessResponse}}`); - - assert.ok( - this.$('i[title="permission"]').attr('class', 'acl-permission__reject'), - 'Render icon is correctly in permission info section' - ); - - assert.equal( - this.$('.acl-permission__meta') - .children('p') - .text() - .trim(), - 'If you feel this is in error, contact acreqjests@linkedin.', - 'Render request form subtitle 2 correctly' - ); -}); - -test('component content renders permission approved', function(assert) { - this.setProperties({ - accessInfo: accessInfo(false), - currentUser, - accessResponse: approvedResponse - }); - - this.render(hbs` - {{dataset-aclaccess - accessInfo=accessInfo - currentUser=currentUser - accessResponse=accessResponse}}`); - - assert.ok( - this.$('i[title="permission"]').attr('class', 'fa fa-check-circle-o fa-lg acl-permission__success'), - 'Render icon is correctly when the user is approved ' - ); - assert.equal( - this.$('.acl-permission__meta') - .children('p') - .text() - .trim(), - 'You now have access to this data', - 'Render request form subtitle 2 correctly' - ); - assert.equal(this.$('.dataset-author-record').length, 2, 'Render table body correctly'); -}); - -test('it should invoke the reset action on cancel', function(assert) { - this.setProperties({ - accessInfo: accessInfo(false), - currentUser, - accessResponse, - requestReason: 'request access' - }); - - this.render(hbs` - {{dataset-aclaccess - accessInfo=accessInfo - currentUser=currentUser - requestReason=requestReason}}`); - - assert.equal(this.get('requestReason'), 'request access'); - - triggerEvent('.nacho-button--secondary', 'click'); - - assert.equal(this.get('requestReason'), ''); + assert.ok(document.querySelector('.acl-permission__header'), 'it renders a constituent element in the DOM'); }); diff --git a/wherehows-web/tests/integration/components/datasets/containers/dataset-acl-access-test.js b/wherehows-web/tests/integration/components/datasets/containers/dataset-acl-access-test.js index 678e15aeb5..12f9da8f4c 100644 --- a/wherehows-web/tests/integration/components/datasets/containers/dataset-acl-access-test.js +++ b/wherehows-web/tests/integration/components/datasets/containers/dataset-acl-access-test.js @@ -1,4 +1,4 @@ -import { moduleForComponent, test } from 'ember-qunit'; +import { moduleForComponent, test, skip } from 'ember-qunit'; import hbs from 'htmlbars-inline-precompile'; moduleForComponent( diff --git a/wherehows-web/tests/unit/utils/datasets/metadata-acquisition-test.js b/wherehows-web/tests/unit/utils/datasets/metadata-acquisition-test.js index db2ef09476..29212bde47 100644 --- a/wherehows-web/tests/unit/utils/datasets/metadata-acquisition-test.js +++ b/wherehows-web/tests/unit/utils/datasets/metadata-acquisition-test.js @@ -1,8 +1,8 @@ import { lastSeenSuggestionInterval, - lowQualitySuggestionConfidenceThreshold, - formatAsCapitalizedStringWithSpaces + lowQualitySuggestionConfidenceThreshold } from 'wherehows-web/constants/metadata-acquisition'; +import { formatAsCapitalizedStringWithSpaces } from 'wherehows-web/utils/helpers/string'; import { module, test } from 'qunit'; module('Unit | Utility | datasets/metadata acquisition');