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
koin_version=3.3.1
org.gradle.parallel=true
#org.gradle.configureondemand=true
org.gradle.configureondemand=true
org.gradle.caching=true
org.gradle.jvmargs=-Xmx2048m -XX:+HeapDumpOnOutOfMemoryError -XX:+UseParallelGC

View File

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

View File

@ -92,6 +92,18 @@ class ActivityPubKtTest {
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 {
TODO("Not yet implemented")
}

View File

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

View File

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

View File

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

View File

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

View File

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

View File

@ -23,23 +23,23 @@ class ServerInitialiseServiceImplTest {
val serverInitialiseServiceImpl = ServerInitialiseServiceImpl(metaRepository)
serverInitialiseServiceImpl.init()
verify(metaRepository,times(1)).save(any())
verify(metaRepository, times(1)).save(any())
}
@Test
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> {
onBlocking { get() } doReturn meta
}
val serverInitialiseServiceImpl = ServerInitialiseServiceImpl(metaRepository)
serverInitialiseServiceImpl.init()
verify(metaRepository,times(0)).save(any())
verify(metaRepository, times(0)).save(any())
}
@Test
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> {
onBlocking { get() } doReturn meta
onBlocking { save(any()) } doReturn Unit
@ -47,10 +47,10 @@ class ServerInitialiseServiceImplTest {
val serverInitialiseServiceImpl = ServerInitialiseServiceImpl(metaRepository)
serverInitialiseServiceImpl.init()
verify(metaRepository,times(1)).save(any())
verify(metaRepository, times(1)).save(any())
argumentCaptor<Meta> {
verify(metaRepository,times(1)).save(capture())
assertEquals(ServerUtil.getImplementationVersion(),firstValue.version)
verify(metaRepository, times(1)).save(capture())
assertEquals(ServerUtil.getImplementationVersion(), firstValue.version)
}
}
}