step2_test.js 22 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658
  1. /**
  2. * Licensed to the Apache Software Foundation (ASF) under one
  3. * or more contributor license agreements. See the NOTICE file
  4. * distributed with this work for additional information
  5. * regarding copyright ownership. The ASF licenses this file
  6. * to you under the Apache License, Version 2.0 (the
  7. * "License"); you may not use this file except in compliance
  8. * with the License. You may obtain a copy of the License at
  9. *
  10. * http://www.apache.org/licenses/LICENSE-2.0
  11. *
  12. * Unless required by applicable law or agreed to in writing, software
  13. * distributed under the License is distributed on an "AS IS" BASIS,
  14. * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  15. * See the License for the specific language governing permissions and
  16. * limitations under the License.
  17. */
  18. var App = require('app');
  19. require('controllers/main/admin/security/add/step2');
  20. require('models/service');
  21. describe('App.MainAdminSecurityAddStep2Controller', function () {
  22. var controller = App.MainAdminSecurityAddStep2Controller.create({
  23. content: {}
  24. });
  25. describe('#clearStep()', function () {
  26. it('Info is empty', function () {
  27. controller.set('stepConfigs', []);
  28. controller.set('securityUsers', []);
  29. controller.clearStep();
  30. expect(controller.get('stepConfigs')).to.be.empty;
  31. expect(controller.get('securityUsers')).to.be.empty;
  32. });
  33. it('Info filled', function () {
  34. controller.set('stepConfigs', [1]);
  35. controller.set('securityUsers', [1]);
  36. controller.clearStep();
  37. expect(controller.get('stepConfigs')).to.be.empty;
  38. expect(controller.get('securityUsers')).to.be.empty;
  39. });
  40. });
  41. describe('#isSubmitDisabled', function () {
  42. var tests = [
  43. {
  44. config: [
  45. {
  46. showConfig: true,
  47. errorCount: 0
  48. }
  49. ],
  50. m: 'All show configs, nothing with errors',
  51. e: false
  52. },
  53. {
  54. config: [
  55. {
  56. showConfig: true,
  57. errorCount: 0
  58. },
  59. {
  60. showConfig: true,
  61. errorCount: 1
  62. }
  63. ],
  64. m: 'All show configs, 1 with errors',
  65. e: true
  66. },
  67. {
  68. config: [
  69. {
  70. showConfig: true,
  71. errorCount: 0
  72. },
  73. {
  74. showConfig: false,
  75. errorCount: 1
  76. }
  77. ],
  78. m: '1 has errors but not visible',
  79. e: false
  80. },
  81. {
  82. config: [
  83. {
  84. showConfig: false,
  85. errorCount: 0
  86. },
  87. {
  88. showConfig: false,
  89. errorCount: 1
  90. }
  91. ],
  92. m: '1 has errors, all not visible',
  93. e: false
  94. },
  95. {
  96. config: [
  97. {
  98. showConfig: true,
  99. errorCount: 1
  100. },
  101. {
  102. showConfig: true,
  103. errorCount: 1
  104. }
  105. ],
  106. m: 'All has errors, all not visible',
  107. e: true
  108. }
  109. ];
  110. tests.forEach(function (test) {
  111. it(test.m, function () {
  112. controller.set('stepConfigs', test.config);
  113. expect(controller.get('isSubmitDisabled')).to.equal(test.e);
  114. });
  115. });
  116. });
  117. describe('#loadStep()', function () {
  118. it('load step', function () {
  119. controller.set('stepConfigs', [
  120. {}
  121. ]);
  122. controller.set('securityUsers', ['user1']);
  123. controller.set('content.services', ['service1']);
  124. controller.set('content.serviceConfigProperties', ['config1']);
  125. sinon.stub(controller, 'clearStep', Em.K);
  126. sinon.stub(controller, 'loadUsers', Em.K);
  127. sinon.stub(controller, 'addUserPrincipals', Em.K);
  128. sinon.stub(controller, 'renderServiceConfigs', Em.K);
  129. sinon.stub(controller, 'changeCategoryOnHa', Em.K);
  130. sinon.stub(controller, 'setStoredConfigsValue', Em.K);
  131. sinon.stub(controller, 'addHostPrincipals', Em.K);
  132. sinon.stub(App.Service, 'find', function () {
  133. return [
  134. {serviceName: 'HDFS'}
  135. ];
  136. });
  137. controller.loadStep();
  138. expect(controller.get('installedServices')).to.eql(['HDFS']);
  139. expect(controller.clearStep.calledOnce).to.be.true;
  140. expect(controller.loadUsers.calledOnce).to.be.true;
  141. expect(controller.addUserPrincipals.calledWith(['service1'], ['user1'])).to.be.true;
  142. expect(controller.addHostPrincipals.calledOnce).to.be.true;
  143. expect(controller.renderServiceConfigs.calledWith(['service1'])).to.be.true;
  144. expect(controller.changeCategoryOnHa.calledWith(['service1'], [{}])).to.be.true;
  145. expect(controller.setStoredConfigsValue.calledWith(['config1'])).to.be.true;
  146. controller.clearStep.restore();
  147. controller.loadUsers.restore();
  148. controller.addUserPrincipals.restore();
  149. controller.renderServiceConfigs.restore();
  150. controller.changeCategoryOnHa.restore();
  151. controller.setStoredConfigsValue.restore();
  152. controller.addHostPrincipals.restore();
  153. App.Service.find.restore();
  154. });
  155. });
  156. describe('#setStoredConfigsValue()', function () {
  157. it('storedConfigProperties is null', function () {
  158. expect(controller.setStoredConfigsValue(null)).to.be.false;
  159. });
  160. it('stepConfigs is empty', function () {
  161. controller.set('stepConfigs', []);
  162. expect(controller.setStoredConfigsValue([])).to.be.true;
  163. expect(controller.get('stepConfigs')).to.be.empty;
  164. });
  165. it('stepConfig has no configs', function () {
  166. controller.set('stepConfigs', [Em.Object.create({
  167. configs: []
  168. })]);
  169. expect(controller.setStoredConfigsValue([])).to.be.true;
  170. expect(controller.get('stepConfigs')[0].get('configs')).to.be.empty;
  171. });
  172. it('stepConfig has no stored configs', function () {
  173. controller.set('stepConfigs', [Em.Object.create({
  174. configs: [Em.Object.create({
  175. name: 'config1',
  176. value: 'value1'
  177. })]
  178. })]);
  179. var storedConfigProperties = [
  180. {
  181. name: 'config2',
  182. value: "value2"
  183. }
  184. ];
  185. expect(controller.setStoredConfigsValue(storedConfigProperties)).to.be.true;
  186. expect(controller.get('stepConfigs')[0].get('configs').findProperty('name', 'config1').get('value')).to.equal('value1');
  187. });
  188. it('stepConfig has stored configs', function () {
  189. controller.set('stepConfigs', [Em.Object.create({
  190. configs: [Em.Object.create({
  191. name: 'config2',
  192. value: 'value1'
  193. })]
  194. })]);
  195. var storedConfigProperties = [
  196. {
  197. name: 'config2',
  198. value: "value2"
  199. }
  200. ];
  201. expect(controller.setStoredConfigsValue(storedConfigProperties)).to.be.true;
  202. expect(controller.get('stepConfigs')[0].get('configs').findProperty('name', 'config2').get('value')).to.equal('value2');
  203. });
  204. });
  205. describe('#renderServiceConfigs()', function () {
  206. it('serviceConfigs and stepConfigs are empty', function () {
  207. controller.set('stepConfigs', []);
  208. controller.renderServiceConfigs([]);
  209. expect(controller.get('selectedService')).to.be.undefined;
  210. });
  211. it('serviceConfigs is empty', function () {
  212. controller.set('stepConfigs', [
  213. {showConfig: true}
  214. ]);
  215. controller.renderServiceConfigs([]);
  216. expect(controller.get('selectedService')).to.eql({showConfig: true});
  217. });
  218. it('serviceConfigs has service', function () {
  219. var serviceConfigs = [
  220. {
  221. serviceName: 'HDFS',
  222. configs: []
  223. }
  224. ];
  225. sinon.stub(controller, 'wrapConfigProperties', function () {
  226. return [];
  227. });
  228. controller.set('stepConfigs', []);
  229. controller.renderServiceConfigs(serviceConfigs);
  230. expect(controller.get('selectedService').get('serviceName')).to.equal('HDFS');
  231. expect(controller.get('selectedService').get('showConfig')).to.be.true;
  232. expect(controller.get('selectedService').get('configs')).to.be.empty;
  233. expect(controller.wrapConfigProperties.calledWith({
  234. serviceName: 'HDFS',
  235. configs: []
  236. })).to.be.true;
  237. controller.wrapConfigProperties.restore();
  238. });
  239. });
  240. describe('#wrapConfigProperties()', function () {
  241. it('_componentConfig is empty', function () {
  242. expect(controller.wrapConfigProperties({configs: []})).to.be.empty;
  243. });
  244. it('serviceConfigs has service', function () {
  245. var mock = Em.Object.create({
  246. validate: Em.K,
  247. isReconfigurable: true,
  248. isEditable: false
  249. });
  250. var _componentConfig = {configs: [
  251. {name: 'config1'}
  252. ]};
  253. sinon.stub(App.ServiceConfigProperty, 'create', function () {
  254. return mock;
  255. });
  256. sinon.spy(mock, 'validate');
  257. expect(controller.wrapConfigProperties(_componentConfig)[0].get('isEditable')).to.be.true;
  258. expect(App.ServiceConfigProperty.create.calledWith({name: 'config1'})).to.be.true;
  259. expect(mock.validate.calledOnce).to.be.true;
  260. mock.validate.restore();
  261. App.ServiceConfigProperty.create.restore();
  262. });
  263. });
  264. describe('#setHostsToConfig()', function () {
  265. it('service is null', function () {
  266. expect(controller.setHostsToConfig(null)).to.be.false;
  267. });
  268. it('service.configs is empty', function () {
  269. controller.set('content.services', [
  270. {
  271. serviceName: 'HDFS',
  272. configs: []
  273. }
  274. ]);
  275. expect(controller.setHostsToConfig('HDFS')).to.be.false;
  276. });
  277. it('No such config name in service.configs', function () {
  278. controller.set('content.services', [
  279. {
  280. serviceName: 'HDFS',
  281. configs: [
  282. {
  283. name: 'config1'
  284. }
  285. ]
  286. }
  287. ]);
  288. expect(controller.setHostsToConfig('HDFS', 'config2')).to.be.false;
  289. });
  290. it('Correct config in service.configs', function () {
  291. sinon.stub(App.Service, 'find', function () {
  292. return Em.Object.create({
  293. hostComponents: [
  294. Em.Object.create({
  295. componentName: 'comp1',
  296. hostName: 'host1'
  297. })
  298. ]
  299. });
  300. });
  301. expect(controller.setHostsToConfig('HDFS', 'config1', ['comp1'])).to.be.true;
  302. expect(controller.get('content.services')[0].configs[0].defaultValue).to.eql(['host1']);
  303. App.Service.find.restore();
  304. });
  305. });
  306. describe('#setHostToPrincipal()', function () {
  307. it('service is null', function () {
  308. expect(controller.setHostToPrincipal(null)).to.be.false;
  309. });
  310. it('service.configs is empty', function () {
  311. controller.set('content.services', [
  312. {
  313. serviceName: 'HDFS',
  314. configs: []
  315. }
  316. ]);
  317. expect(controller.setHostToPrincipal('HDFS')).to.be.false;
  318. });
  319. it('No such hostConfigName name in service.configs', function () {
  320. controller.set('content.services', [
  321. {
  322. serviceName: 'HDFS',
  323. configs: [
  324. {
  325. name: 'config1'
  326. }
  327. ]
  328. }
  329. ]);
  330. expect(controller.setHostToPrincipal('HDFS', 'config2', 'config1')).to.be.false;
  331. });
  332. it('No such principalConfigName name in service.configs', function () {
  333. expect(controller.setHostToPrincipal('HDFS', 'config1', 'config2')).to.be.false;
  334. });
  335. it('Correct config in service.configs', function () {
  336. controller.set('content.services', [
  337. {
  338. serviceName: 'HDFS',
  339. configs: [
  340. {
  341. name: 'config1',
  342. defaultValue: 'value1'
  343. },
  344. {
  345. name: 'principal1'
  346. }
  347. ]
  348. }
  349. ]);
  350. expect(controller.setHostToPrincipal('HDFS', 'config1', 'principal1', 'name1')).to.be.true;
  351. expect(controller.get('content.services')[0].configs[0].defaultValue).to.equal('value1');
  352. expect(controller.get('content.services')[0].configs[1].defaultValue).to.equal('name1value1');
  353. });
  354. it('Correct config in service.configs, defaultValue is array', function () {
  355. controller.set('content.services', [
  356. {
  357. serviceName: 'HDFS',
  358. configs: [
  359. {
  360. name: 'config1',
  361. defaultValue: ['Value1']
  362. },
  363. {
  364. name: 'principal1'
  365. }
  366. ]
  367. }
  368. ]);
  369. expect(controller.setHostToPrincipal('HDFS', 'config1', 'principal1', 'name1')).to.be.true;
  370. expect(controller.get('content.services')[0].configs[0].defaultValue).to.equal('Value1');
  371. expect(controller.get('content.services')[0].configs[1].defaultValue).to.equal('name1value1');
  372. });
  373. });
  374. describe('#loadUsers()', function () {
  375. afterEach(function () {
  376. App.router.get.restore();
  377. });
  378. it('serviceUsers is correct', function () {
  379. sinon.stub(App.router, 'get', function () {
  380. return Em.Object.create({serviceUsers: [
  381. {}
  382. ]})
  383. });
  384. controller.loadUsers();
  385. expect(controller.get('securityUsers')).to.eql([
  386. {}
  387. ]);
  388. });
  389. it('serviceUsers is null, testMode = true', function () {
  390. sinon.stub(App.router, 'get', function () {
  391. return Em.Object.create({serviceUsers: null})
  392. });
  393. sinon.stub(App, 'get', function(k) {
  394. if ('testMode' === k) return true;
  395. return Em.get(App, k);
  396. });
  397. controller.loadUsers();
  398. expect(controller.get('securityUsers').mapProperty('name')).to.eql(["hdfs_user",
  399. "mapred_user",
  400. "hbase_user",
  401. "hive_user",
  402. "smokeuser"
  403. ]);
  404. App.get.restore();
  405. });
  406. it('serviceUsers is empty, testMode = true', function () {
  407. sinon.stub(App.router, 'get', function () {
  408. return Em.Object.create({serviceUsers: []})
  409. });
  410. sinon.stub(App, 'get', function(k) {
  411. if ('testMode' === k) return true;
  412. return Em.get(App, k);
  413. });
  414. controller.loadUsers();
  415. expect(controller.get('securityUsers').mapProperty('name')).to.eql(["hdfs_user",
  416. "mapred_user",
  417. "hbase_user",
  418. "hive_user",
  419. "smokeuser"
  420. ]);
  421. App.get.restore();
  422. });
  423. it('serviceUsers is null, testMode = false', function () {
  424. sinon.stub(App.router, 'get', function () {
  425. return Em.Object.create({serviceUsers: null})
  426. });
  427. sinon.stub(App.db, 'getSecureUserInfo', function () {
  428. return [
  429. {}
  430. ];
  431. });
  432. sinon.stub(App, 'get', function(k) {
  433. if ('testMode' === k) return false;
  434. return Em.get(App, k);
  435. });
  436. controller.loadUsers();
  437. expect(controller.get('securityUsers')).to.eql([
  438. {}
  439. ]);
  440. expect(App.db.getSecureUserInfo.calledOnce).to.be.true;
  441. App.db.getSecureUserInfo.restore();
  442. App.get.restore();
  443. });
  444. it('serviceUsers is empty, testMode = false', function () {
  445. sinon.stub(App.router, 'get', function () {
  446. return Em.Object.create({serviceUsers: []})
  447. });
  448. sinon.stub(App.db, 'getSecureUserInfo', function () {
  449. return [
  450. {}
  451. ];
  452. });
  453. sinon.stub(App, 'get', function(k) {
  454. if ('testMode' === k) return false;
  455. return Em.get(App, k);
  456. });
  457. controller.loadUsers();
  458. expect(controller.get('securityUsers')).to.eql([
  459. {}
  460. ]);
  461. expect(App.db.getSecureUserInfo.calledOnce).to.be.true;
  462. App.db.getSecureUserInfo.restore();
  463. App.get.restore();
  464. });
  465. });
  466. describe('#addUserPrincipals()', function () {
  467. beforeEach(function () {
  468. sinon.stub(controller, 'setUserPrincipalValue', function () {
  469. return true;
  470. });
  471. });
  472. afterEach(function () {
  473. controller.setUserPrincipalValue.restore();
  474. });
  475. var generalConfigs = [
  476. {
  477. serviceName: 'GENERAL',
  478. configs: [
  479. {
  480. name: 'hbase_principal_name',
  481. isVisible: false
  482. },
  483. {
  484. name: 'hbase_user_keytab',
  485. isVisible: false
  486. },
  487. {
  488. name: 'hdfs_principal_name',
  489. isVisible: false
  490. },
  491. {
  492. name: 'hdfs_user_keytab',
  493. isVisible: false
  494. }
  495. ]
  496. }
  497. ];
  498. var securityUsers = [];
  499. it('HBASE or HDFS services are not installed neither', function () {
  500. var serviceConfigs = generalConfigs.slice(0);
  501. controller.addUserPrincipals(serviceConfigs, securityUsers);
  502. expect(serviceConfigs[0].configs.findProperty('name', 'hbase_principal_name').isVisible).to.be.false;
  503. expect(serviceConfigs[0].configs.findProperty('name', 'hbase_user_keytab').isVisible).to.be.false;
  504. });
  505. it('HBASE service is installed', function () {
  506. var serviceConfigs = generalConfigs.slice(0);
  507. serviceConfigs.push({serviceName: 'HBASE'});
  508. controller.addUserPrincipals(serviceConfigs, securityUsers);
  509. expect(serviceConfigs[0].configs.findProperty('name', 'hbase_principal_name').isVisible).to.be.true;
  510. expect(serviceConfigs[0].configs.findProperty('name', 'hbase_user_keytab').isVisible).to.be.true;
  511. });
  512. it('HDFS service is installed', function () {
  513. var serviceConfigs = generalConfigs.slice(0);
  514. serviceConfigs.push({serviceName: 'HDFS'});
  515. controller.addUserPrincipals(serviceConfigs, securityUsers);
  516. expect(serviceConfigs[0].configs.findProperty('name', 'hdfs_principal_name').isVisible).to.be.true;
  517. expect(serviceConfigs[0].configs.findProperty('name', 'hdfs_user_keytab').isVisible).to.be.true;
  518. });
  519. it('HDFS and HBASE services are installed', function () {
  520. var serviceConfigs = generalConfigs.slice(0);
  521. serviceConfigs.push({serviceName: 'HDFS'});
  522. serviceConfigs.push({serviceName: 'HBASE'});
  523. controller.addUserPrincipals(serviceConfigs, securityUsers);
  524. expect(serviceConfigs[0].configs.findProperty('name', 'hdfs_principal_name').isVisible).to.be.true;
  525. expect(serviceConfigs[0].configs.findProperty('name', 'hdfs_user_keytab').isVisible).to.be.true;
  526. expect(serviceConfigs[0].configs.findProperty('name', 'hbase_principal_name').isVisible).to.be.true;
  527. expect(serviceConfigs[0].configs.findProperty('name', 'hbase_user_keytab').isVisible).to.be.true;
  528. });
  529. });
  530. describe('#setUserPrincipalValue()', function () {
  531. it('user and userPrincipal are null', function () {
  532. expect(controller.setUserPrincipalValue(null, null)).to.be.false;
  533. });
  534. it('user is null', function () {
  535. expect(controller.setUserPrincipalValue(null, {})).to.be.false;
  536. });
  537. it('userPrincipal is null', function () {
  538. expect(controller.setUserPrincipalValue({}, null)).to.be.false;
  539. });
  540. it('user and userPrincipal are correct', function () {
  541. var user = {value: 'value1'};
  542. var userPrincipal = {};
  543. expect(controller.setUserPrincipalValue(user, userPrincipal)).to.be.true;
  544. expect(userPrincipal.defaultValue).to.equal('value1');
  545. });
  546. });
  547. describe('#addHostPrincipals()', function () {
  548. it('hostToPrincipalMap is empty', function () {
  549. sinon.stub(controller, 'setHostToPrincipal', Em.K);
  550. controller.set('hostToPrincipalMap', []);
  551. controller.addHostPrincipals();
  552. expect(controller.setHostToPrincipal.called).to.be.false;
  553. controller.setHostToPrincipal.restore();
  554. });
  555. it('Correct data', function () {
  556. sinon.stub(controller, 'setHostToPrincipal', Em.K);
  557. controller.set('hostToPrincipalMap', [
  558. {
  559. serviceName: 'HDFS',
  560. configName: 'datanode_hosts',
  561. principalName: 'principal1',
  562. primaryName: 'name1'
  563. }
  564. ]);
  565. controller.addHostPrincipals();
  566. expect(controller.setHostToPrincipal.calledWith('HDFS', 'datanode_hosts', 'principal1', 'name1')).to.be.true;
  567. controller.setHostToPrincipal.restore();
  568. });
  569. });
  570. describe('#changeCategoryOnHa()', function () {
  571. beforeEach(function () {
  572. sinon.stub(controller, 'removeConfigCategory', Em.K);
  573. });
  574. afterEach(function () {
  575. controller.removeConfigCategory.restore();
  576. });
  577. var serviceConfigs = [{
  578. serviceName: 'HDFS',
  579. configCategories: []
  580. }];
  581. var stepConfigs = [Em.Object.create({
  582. serviceName: 'HDFS',
  583. configs: []
  584. })];
  585. it('HDFS service is absent', function () {
  586. expect(controller.changeCategoryOnHa([], [])).to.be.false;
  587. });
  588. it('HDFS service installed, App.testMode and App.testNameNodeHA - true', function () {
  589. sinon.stub(App, 'get', function(k) {
  590. if ('testMode' === k) return true;
  591. if ('testNameNodeHA' === k) return true;
  592. return Em.get(App, k);
  593. });
  594. expect(controller.changeCategoryOnHa(serviceConfigs, stepConfigs)).to.be.true;
  595. expect(controller.removeConfigCategory.calledWith([], [], 'SNameNode')).to.be.true;
  596. App.get.restore();
  597. });
  598. it('HDFS service installed, content.isNnHa = true', function () {
  599. controller.set('content.isNnHa', 'true');
  600. expect(controller.changeCategoryOnHa(serviceConfigs, stepConfigs)).to.be.true;
  601. expect(controller.removeConfigCategory.calledWith([], [], 'SNameNode')).to.be.true;
  602. });
  603. it('HDFS service installed, HA disabled', function () {
  604. controller.set('content.isNnHa', 'false');
  605. expect(controller.changeCategoryOnHa(serviceConfigs, stepConfigs)).to.be.true;
  606. expect(controller.removeConfigCategory.calledWith([], [], 'JournalNode')).to.be.true;
  607. });
  608. });
  609. describe('#removeConfigCategory()', function () {
  610. it('properties should be hidden', function () {
  611. var properties = [
  612. Em.Object.create({
  613. category: 'comp1',
  614. isVisible: true
  615. })
  616. ];
  617. controller.removeConfigCategory(properties, [], 'comp1');
  618. expect(properties[0].isVisible).to.be.false;
  619. });
  620. it('category should be removed', function () {
  621. var configCategories = [
  622. Em.Object.create({
  623. name: 'comp1'
  624. })
  625. ];
  626. controller.removeConfigCategory([], configCategories, 'comp1');
  627. expect(configCategories).to.be.empty;
  628. });
  629. });
  630. });