From 4e1e8e6b9f0f3a8c7ffc95a9a1237a09778687e9 Mon Sep 17 00:00:00 2001 From: Don Walizer <12420708+dwalizer@users.noreply.github.com> Date: Thu, 9 Jan 2025 13:44:20 -0500 Subject: [PATCH] #3032 Add a test for imported skills --- .../skills/intTests/UserPointsSpecs.groovy | 27 +++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/service/src/test/java/skills/intTests/UserPointsSpecs.groovy b/service/src/test/java/skills/intTests/UserPointsSpecs.groovy index fb318daaf..d48cd9700 100644 --- a/service/src/test/java/skills/intTests/UserPointsSpecs.groovy +++ b/service/src/test/java/skills/intTests/UserPointsSpecs.groovy @@ -179,6 +179,31 @@ class UserPointsSpecs extends DefaultIntSpec { result2User.firstUpdated == DTF.print(threeDaysAgo.time) } + def 'get skill users returns correct firstUpdated and lastUpdated date for imported skill'() { + def subj1_skills = skillsService.getSkillsForSubject(projId, subjects.get(0)) + + def project2 = SkillsFactory.createProject(11) + def project2_subject = SkillsFactory.createSubject(11, 1) + def project2_skill2 = SkillsFactory.createSkill(11, 1, 2, 0, 10, 0, 100) + skillsService.createProjectAndSubjectAndSkills(project2, project2_subject, [project2_skill2]) + + skillsService.exportSkillToCatalog(projId, subj1_skills[0].skillId) + skillsService.importSkillFromCatalog(project2.projectId, project2_subject.subjectId, subj1_skills[0].projectId, subj1_skills[0].skillId) + skillsService.finalizeSkillsImportFromCatalog(project2.projectId) + + when: + def results = skillsService.getSkillUsers(project2.projectId, subj1_skills[0].skillId) + + then: + results + results.count == 1 + results.data.size() == 1 + + def result2User = results.data.find { it -> it.userId == sampleUserIds.get(0).toLowerCase() } + result2User.lastUpdated == DTF.print(threeDaysAgo.time) + result2User.firstUpdated == DTF.print(threeDaysAgo.time) + } + def 'get badge users returns correct firstUpdated and lastUpdated date'() { skillsService.addSkill(['projectId': projId, skillId: allSkillIds.get(0).get(0)], sampleUserIds.get(0), yesterday) skillsService.addSkill(['projectId': projId, skillId: allSkillIds.get(0).get(0)], sampleUserIds.get(1), threeDaysAgo) @@ -200,6 +225,8 @@ class UserPointsSpecs extends DefaultIntSpec { result2User.firstUpdated == DTF.print(threeDaysAgo.time) } + + def 'get project users when project exists'() { when: def results = skillsService.getProjectUsers(projId)