style: スタイルを修正

This commit is contained in:
usbharu 2023-06-02 17:31:54 +09:00
parent f2c2370659
commit e7b0df8afb
9 changed files with 66 additions and 35 deletions

View File

@ -6,6 +6,6 @@ exposed_version=0.41.1
h2_version=2.1.214 h2_version=2.1.214
koin_version=3.3.1 koin_version=3.3.1
org.gradle.parallel=true org.gradle.parallel=true
#org.gradle.configureondemand=true org.gradle.configureondemand=true
org.gradle.caching=true org.gradle.caching=true
org.gradle.jvmargs=-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError -XX:+UseParallelGC org.gradle.jvmargs=-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError -XX:+UseParallelGC

View File

@ -30,7 +30,8 @@ class UndoTest {
@Test @Test
fun Undoをデシリアライズ出来る() { fun Undoをデシリアライズ出来る() {
@Language("JSON") val json = """ @Language("JSON")
val json = """
{ {
"@context": [ "@context": [
"https://www.w3.org/ns/activitystreams", "https://www.w3.org/ns/activitystreams",

View File

@ -92,6 +92,18 @@ class ActivityPubKtTest {
TODO("Not yet implemented") TODO("Not yet implemented")
} }
override suspend fun addFollowRequest(id: Long, follower: Long) {
TODO("Not yet implemented")
}
override suspend fun deleteFollowRequest(id: Long, follower: Long) {
TODO("Not yet implemented")
}
override suspend fun findFollowRequestsById(id: Long, follower: Long): Boolean {
TODO("Not yet implemented")
}
override suspend fun nextId(): Long { override suspend fun nextId(): Long {
TODO("Not yet implemented") TODO("Not yet implemented")
} }

View File

@ -41,11 +41,14 @@ class JwtRefreshTokenRepositoryImplTest {
@Test @Test
fun `save 存在しない場合はinsertする`() = runTest { fun `save 存在しない場合はinsertする`() = runTest {
val repository = JwtRefreshTokenRepositoryImpl(db, object : IdGenerateService { val repository = JwtRefreshTokenRepositoryImpl(
override suspend fun generateId(): Long { db,
TODO("Not yet implemented") object : IdGenerateService {
override suspend fun generateId(): Long {
TODO("Not yet implemented")
}
} }
}) )
val now = Instant.now(Clock.tickMillis(ZoneId.systemDefault())) val now = Instant.now(Clock.tickMillis(ZoneId.systemDefault()))
val expiresAt = now.plus(10, ChronoUnit.MINUTES) val expiresAt = now.plus(10, ChronoUnit.MINUTES)
@ -57,11 +60,14 @@ class JwtRefreshTokenRepositoryImplTest {
@Test @Test
fun `save 存在する場合はupdateする`() = runTest { fun `save 存在する場合はupdateする`() = runTest {
val repository = JwtRefreshTokenRepositoryImpl(db, object : IdGenerateService { val repository = JwtRefreshTokenRepositoryImpl(
override suspend fun generateId(): Long { db,
TODO("Not yet implemented") object : IdGenerateService {
override suspend fun generateId(): Long {
TODO("Not yet implemented")
}
} }
}) )
transaction { transaction {
JwtRefreshTokens.insert { JwtRefreshTokens.insert {
it[id] = 1L it[id] = 1L

View File

@ -30,7 +30,7 @@ class ContentTypeRouteSelectorTest {
} }
} }
client.get("/test"){ client.get("/test") {
accept(ContentType.Text.Html) accept(ContentType.Text.Html)
}.apply { }.apply {
assertEquals("NG", bodyAsText()) assertEquals("NG", bodyAsText())
@ -60,7 +60,7 @@ class ContentTypeRouteSelectorTest {
} }
} }
client.get("/test"){ client.get("/test") {
accept(ContentType.Text.Html) accept(ContentType.Text.Html)
}.apply { }.apply {
assertEquals("NG", bodyAsText()) assertEquals("NG", bodyAsText())
@ -85,7 +85,7 @@ class ContentTypeRouteSelectorTest {
} }
} }
client.get("/test"){ client.get("/test") {
accept(ContentType.Text.Html) accept(ContentType.Text.Html)
}.apply { }.apply {
assertEquals("NG", bodyAsText()) assertEquals("NG", bodyAsText())
@ -114,18 +114,18 @@ class ContentTypeRouteSelectorTest {
} }
} }
client.get("/test"){ client.get("/test") {
accept(ContentType.Text.Html) accept(ContentType.Text.Html)
}.apply { }.apply {
assertEquals("OK", bodyAsText()) assertEquals("OK", bodyAsText())
} }
client.get("/test"){ client.get("/test") {
accept(ContentType.Application.Json) accept(ContentType.Application.Json)
}.apply { }.apply {
assertEquals("OK", bodyAsText()) assertEquals("OK", bodyAsText())
} }
client.get("/test"){ client.get("/test") {
accept(ContentType.Application.Xml) accept(ContentType.Application.Xml)
}.apply { }.apply {
assertEquals("NG", bodyAsText()) assertEquals("NG", bodyAsText())

View File

@ -158,8 +158,12 @@ class PostsTest {
config = ApplicationConfig("empty.conf") config = ApplicationConfig("empty.conf")
} }
val post = Post( val post = Post(
12345, 1234, text = "aaa", visibility = Visibility.PUBLIC, 12345,
createdAt = Instant.now().toEpochMilli(), url = "https://example.com/posts/1" 1234,
text = "aaa",
visibility = Visibility.PUBLIC,
createdAt = Instant.now().toEpochMilli(),
url = "https://example.com/posts/1"
) )
val postService = mock<IPostService> { val postService = mock<IPostService> {
onBlocking { findByIdForUser(any(), anyOrNull()) } doReturn post onBlocking { findByIdForUser(any(), anyOrNull()) } doReturn post
@ -185,8 +189,12 @@ class PostsTest {
config = ApplicationConfig("empty.conf") config = ApplicationConfig("empty.conf")
} }
val post = Post( val post = Post(
12345, 1234, text = "aaa", visibility = Visibility.FOLLOWERS, 12345,
createdAt = Instant.now().toEpochMilli(), url = "https://example.com/posts/1" 1234,
text = "aaa",
visibility = Visibility.FOLLOWERS,
createdAt = Instant.now().toEpochMilli(),
url = "https://example.com/posts/1"
) )
val postService = mock<IPostService> { val postService = mock<IPostService> {
onBlocking { findByIdForUser(any(), isNotNull()) } doReturn post onBlocking { findByIdForUser(any(), isNotNull()) } doReturn post
@ -247,7 +255,6 @@ class PostsTest {
} }
application { application {
authentication { authentication {
bearer(TOKEN_AUTH) { bearer(TOKEN_AUTH) {
authenticate { authenticate {
println("aaaaaaaaaaaa") println("aaaaaaaaaaaa")

View File

@ -290,7 +290,8 @@ class UsersTest {
"test User", "test User",
"https://example.com/test", "https://example.com/test",
Instant.now().toEpochMilli() Instant.now().toEpochMilli()
), UserResponse( ),
UserResponse(
1236, 1236,
"follower2", "follower2",
"example.com", "example.com",
@ -334,7 +335,8 @@ class UsersTest {
"test User", "test User",
"https://example.com/test", "https://example.com/test",
Instant.now().toEpochMilli() Instant.now().toEpochMilli()
), UserResponse( ),
UserResponse(
1236, 1236,
"follower2", "follower2",
"example.com", "example.com",
@ -378,7 +380,8 @@ class UsersTest {
"test User", "test User",
"https://example.com/test", "https://example.com/test",
Instant.now().toEpochMilli() Instant.now().toEpochMilli()
), UserResponse( ),
UserResponse(
1236, 1236,
"follower2", "follower2",
"example.com", "example.com",
@ -572,7 +575,8 @@ class UsersTest {
"test User", "test User",
"https://example.com/test", "https://example.com/test",
Instant.now().toEpochMilli() Instant.now().toEpochMilli()
), UserResponse( ),
UserResponse(
1236, 1236,
"follower2", "follower2",
"example.com", "example.com",
@ -616,7 +620,8 @@ class UsersTest {
"test User", "test User",
"https://example.com/test", "https://example.com/test",
Instant.now().toEpochMilli() Instant.now().toEpochMilli()
), UserResponse( ),
UserResponse(
1236, 1236,
"follower2", "follower2",
"example.com", "example.com",
@ -660,7 +665,8 @@ class UsersTest {
"test User", "test User",
"https://example.com/test", "https://example.com/test",
Instant.now().toEpochMilli() Instant.now().toEpochMilli()
), UserResponse( ),
UserResponse(
1236, 1236,
"follower2", "follower2",
"example.com", "example.com",

View File

@ -37,7 +37,6 @@ class MetaServiceImplTest {
@Test @Test
fun `updateMeta メタデータを保存できる`() = runTest { fun `updateMeta メタデータを保存できる`() = runTest {
val meta = Meta("1.0.1", Jwt(UUID.randomUUID(), "sdfsdjk", "adafda")) val meta = Meta("1.0.1", Jwt(UUID.randomUUID(), "sdfsdjk", "adafda"))
val metaRepository = mock<IMetaRepository> { val metaRepository = mock<IMetaRepository> {
onBlocking { save(any()) } doReturn Unit onBlocking { save(any()) } doReturn Unit

View File

@ -23,23 +23,23 @@ class ServerInitialiseServiceImplTest {
val serverInitialiseServiceImpl = ServerInitialiseServiceImpl(metaRepository) val serverInitialiseServiceImpl = ServerInitialiseServiceImpl(metaRepository)
serverInitialiseServiceImpl.init() serverInitialiseServiceImpl.init()
verify(metaRepository,times(1)).save(any()) verify(metaRepository, times(1)).save(any())
} }
@Test @Test
fun `init メタデータが存在して同じバージョンのときは何もしない`() = runTest { fun `init メタデータが存在して同じバージョンのときは何もしない`() = runTest {
val meta = Meta(ServerUtil.getImplementationVersion(), Jwt(UUID.randomUUID(),"aaafafd","afafasdf")) val meta = Meta(ServerUtil.getImplementationVersion(), Jwt(UUID.randomUUID(), "aaafafd", "afafasdf"))
val metaRepository = mock<IMetaRepository> { val metaRepository = mock<IMetaRepository> {
onBlocking { get() } doReturn meta onBlocking { get() } doReturn meta
} }
val serverInitialiseServiceImpl = ServerInitialiseServiceImpl(metaRepository) val serverInitialiseServiceImpl = ServerInitialiseServiceImpl(metaRepository)
serverInitialiseServiceImpl.init() serverInitialiseServiceImpl.init()
verify(metaRepository,times(0)).save(any()) verify(metaRepository, times(0)).save(any())
} }
@Test @Test
fun `init メタデータが存在して違うバージョンのときはバージョンを変更する`() = runTest { fun `init メタデータが存在して違うバージョンのときはバージョンを変更する`() = runTest {
val meta = Meta("1.0.0", Jwt(UUID.randomUUID(),"aaafafd","afafasdf")) val meta = Meta("1.0.0", Jwt(UUID.randomUUID(), "aaafafd", "afafasdf"))
val metaRepository = mock<IMetaRepository> { val metaRepository = mock<IMetaRepository> {
onBlocking { get() } doReturn meta onBlocking { get() } doReturn meta
onBlocking { save(any()) } doReturn Unit onBlocking { save(any()) } doReturn Unit
@ -47,10 +47,10 @@ class ServerInitialiseServiceImplTest {
val serverInitialiseServiceImpl = ServerInitialiseServiceImpl(metaRepository) val serverInitialiseServiceImpl = ServerInitialiseServiceImpl(metaRepository)
serverInitialiseServiceImpl.init() serverInitialiseServiceImpl.init()
verify(metaRepository,times(1)).save(any()) verify(metaRepository, times(1)).save(any())
argumentCaptor<Meta> { argumentCaptor<Meta> {
verify(metaRepository,times(1)).save(capture()) verify(metaRepository, times(1)).save(capture())
assertEquals(ServerUtil.getImplementationVersion(),firstValue.version) assertEquals(ServerUtil.getImplementationVersion(), firstValue.version)
} }
} }
} }