From 0920b414adad420e77867b96494e61f2711ceaf9 Mon Sep 17 00:00:00 2001 From: Shiina Kin Date: Fri, 25 Oct 2024 23:40:00 +0800 Subject: [PATCH] fix: RoleServiceTest --- .../sakurasou/service/role/RoleServiceTest.kt | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/app/src/test/kotlin/io/sakurasou/service/role/RoleServiceTest.kt b/app/src/test/kotlin/io/sakurasou/service/role/RoleServiceTest.kt index 775725e1..1b8ca6c3 100644 --- a/app/src/test/kotlin/io/sakurasou/service/role/RoleServiceTest.kt +++ b/app/src/test/kotlin/io/sakurasou/service/role/RoleServiceTest.kt @@ -49,12 +49,12 @@ class RoleServiceTest { val permission1 = Permission("permission1", "description1") val permission2 = Permission("permission2", null) val permission3 = Permission("permission3", "description3") - val expected = mapOf( - role1.name to RoleVO(role1.name, role1.description, listOf( + val expected = listOf( + RoleVO(role1.name, role1.description, listOf( PermissionVO(permission1.name, permission1.description), PermissionVO(permission2.name, permission2.description) )), - role2.name to RoleVO(role2.name, role2.description, listOf( + RoleVO(role2.name, role2.description, listOf( PermissionVO(permission2.name, permission2.description), PermissionVO(permission3.name, permission3.description) )) @@ -66,8 +66,8 @@ class RoleServiceTest { every { permissionDao.findPermissionByName(permission1.name) } returns permission1 every { permissionDao.findPermissionByName(permission2.name) } returns permission2 every { permissionDao.findPermissionByName(permission3.name) } returns permission3 - coEvery { DatabaseSingleton.dbQuery>(any()) } coAnswers { - this.arg Map>(0).invoke() + coEvery { DatabaseSingleton.dbQuery>(any()) } coAnswers { + this.arg List>(0).invoke() } val rolesWithPermissions = roleService.listRolesWithPermissions() @@ -80,8 +80,8 @@ class RoleServiceTest { val role1 = Role("role1", null) val permission1 = Permission("permission1", "description1") val permission2 = Permission("permission2", null) - val expected = mapOf( - role1.name to RoleVO(role1.name, role1.description, listOf( + val expected = listOf( + RoleVO(role1.name, role1.description, listOf( PermissionVO(permission1.name, permission1.description), PermissionVO(permission2.name, permission2.description) )) @@ -91,8 +91,8 @@ class RoleServiceTest { every { relationDao.listPermissionByRole(role1.name) } returns listOf(permission1.name, permission2.name) every { permissionDao.findPermissionByName(permission1.name) } returns permission1 every { permissionDao.findPermissionByName(permission2.name) } returns permission2 - coEvery { DatabaseSingleton.dbQuery>(any()) } coAnswers { - this.arg Map>(0).invoke() + coEvery { DatabaseSingleton.dbQuery>(any()) } coAnswers { + this.arg List>(0).invoke() } val rolesWithPermissions = roleService.listRolesWithPermissionsOfUser(listOf(role1.name))