Tarea #1814 refactor fixtures userPhone
gitea/salix/dev This commit looks good Details

This commit is contained in:
Bernat 2019-10-21 08:52:42 +02:00
parent e9f65cd2a6
commit 6adeb689eb
2 changed files with 88 additions and 41 deletions

View File

@ -1864,44 +1864,65 @@ INSERT INTO `vn`.`queuePriority`(`id`, `priority`)
(2, 'Normal'), (2, 'Normal'),
(3, 'Baja'); (3, 'Baja');
-- Fixtures para userPhone, #1814 INSERT INTO `vn`.`userPhone`(`id`, `userFk`, `typeFk`, `phone`)
VALUES
insert into vn.userPhone(userFk,typeFk,phone) (1, 101, 'personalPhone', 1111111111),
select id,'personalPhone', phone (2, 102, 'personalPhone', 1111111111),
from vn.client (3, 103, 'personalPhone', 1111111111),
where phone is not null; (4, 104, 'personalPhone', 1111111111),
(5, 105, 'personalPhone', 1111111111),
insert into vn.userPhone(userFk,typeFk,phone) (6, 106, 'personalPhone', 1111111111),
select id,'businessPhone', phone (7, 107, 'personalPhone', 1111111111),
from vn.worker (8, 108, 'personalPhone', 1111111111),
where phone is not null AND phone > ''; (9, 109, 'personalPhone', 1111111111),
(10, 110, 'personalPhone', 1111111111),
insert into vn.userPhone(userFk,typeFk,phone) (11, 111, 'personalPhone', 1111111111),
SELECT (12, 112, 'personalPhone', 1111111111),
`w`.`userFk`, (13, 1, 'personalPhone', 623111111),
'businessPhone', (14, 2, 'personalPhone', 623111111),
`m`.`value` AS `mediaValue` (15, 3, 'personalPhone', 623111111),
FROM (16, 5, 'personalPhone', 623111111),
(((((`postgresql`.`person` `p` (17, 6, 'personalPhone', 623111111),
JOIN `postgresql`.`profile` `po` ON ((`po`.`person_id` = `p`.`person_id`))) (18, 9, 'personalPhone', 623111111),
JOIN `postgresql`.`profile_media` `pom` ON ((`pom`.`profile_id` = `po`.`profile_id`))) (19, 13, 'personalPhone', 623111111),
JOIN `postgresql`.`media` `m` ON ((`m`.`media_id` = `pom`.`media_id`))) (20, 15, 'personalPhone', 623111111),
JOIN `postgresql`.`media_type` `mt` ON ((`mt`.`media_type_id` = `m`.`media_type_id`))) (21, 16, 'personalPhone', 623111111),
JOIN `vn`.`worker` `w` ON ((`w`.`id` = `p`.`id_trabajador`))) (22, 17, 'personalPhone', 623111111),
WHERE (23, 18, 'personalPhone', 623111111),
(`mt`.`name` = 'movil empresa'); (24, 19, 'personalPhone', 623111111),
(25, 20, 'personalPhone', 623111111),
insert into vn.userPhone(userFk,typeFk,phone) (26, 21, 'personalPhone', 623111111),
SELECT (27, 22, 'personalPhone', 623111111),
`w`.`userFk`, (28, 30, 'personalPhone', 623111111),
'personalPhone', (29, 31, 'personalPhone', 623111111),
`m`.`value` AS `mediaValue` (30, 32, 'personalPhone', 623111111),
FROM (31, 34, 'personalPhone', 623111111),
(((((`postgresql`.`person` `p` (32, 35, 'personalPhone', 623111111),
JOIN `postgresql`.`profile` `po` ON ((`po`.`person_id` = `p`.`person_id`))) (33, 36, 'personalPhone', 623111111),
JOIN `postgresql`.`profile_media` `pom` ON ((`pom`.`profile_id` = `po`.`profile_id`))) (34, 37, 'personalPhone', 623111111),
JOIN `postgresql`.`media` `m` ON ((`m`.`media_id` = `pom`.`media_id`))) (35, 38, 'personalPhone', 623111111),
JOIN `postgresql`.`media_type` `mt` ON ((`mt`.`media_type_id` = `m`.`media_type_id`))) (36, 39, 'personalPhone', 623111111),
JOIN `vn`.`worker` `w` ON ((`w`.`id` = `p`.`id_trabajador`))) (37, 40, 'personalPhone', 623111111),
WHERE (38, 41, 'personalPhone', 623111111),
(`mt`.`name` = 'movil personal'); (39, 42, 'personalPhone', 623111111),
(40, 43, 'personalPhone', 623111111),
(41, 44, 'personalPhone', 623111111),
(42, 45, 'personalPhone', 623111111),
(43, 47, 'personalPhone', 623111111),
(44, 48, 'personalPhone', 623111111),
(45, 50, 'personalPhone', 623111111),
(46, 51, 'personalPhone', 623111111),
(47, 52, 'personalPhone', 623111111),
(48, 54, 'personalPhone', 623111111),
(49, 55, 'personalPhone', 623111111),
(50, 56, 'personalPhone', 623111111),
(51, 57, 'personalPhone', 623111111),
(52, 58, 'personalPhone', 623111111),
(53, 59, 'personalPhone', 623111111),
(54, 60, 'personalPhone', 623111111),
(55, 61, 'personalPhone', 623111111),
(56, 65, 'personalPhone', 623111111),
(57, 66, 'personalPhone', 623111111),
(65, 107, 'businessPhone', 700987987),
(67, 106, 'businessPhone', 1111111112),
(68, 106, 'personalPhone', 1111111113);

View File

@ -0,0 +1,26 @@
import './index';
describe('Component vnWorkerPhones', () => {
let controller;
beforeEach(angular.mock.module('worker', $translateProvider => {
$translateProvider.translations('en', {});
}));
beforeEach(angular.mock.inject(($componentController, $rootScope) => {
let $scope = $rootScope.$new();
controller = $componentController('vnWorkerPhones', $scope);
controller.$scope.model = {link: 1};
controller.$scope.$applyAsync = () => {};
}));
describe('setLink()', () => {
it('set the link in the model and refreshes it', () => {
spyOn(controller.$scope, '$applyAsync');
let value = {userFk: 106};
controller.setLink(value);
expect(controller.$scope.$applyAsync).toHaveBeenCalledWith(jasmine.any(Function));
});
});
});