Recode unit test
This commit is contained in:
@@ -2,21 +2,25 @@ package top.fatweb.api
|
|||||||
|
|
||||||
import org.junit.jupiter.api.Assertions.assertEquals
|
import org.junit.jupiter.api.Assertions.assertEquals
|
||||||
import org.junit.jupiter.api.Test
|
import org.junit.jupiter.api.Test
|
||||||
import org.springframework.boot.test.context.SpringBootTest
|
import org.junit.jupiter.api.extension.ExtendWith
|
||||||
|
import org.springframework.test.context.junit.jupiter.SpringExtension
|
||||||
import top.fatweb.api.constant.SecurityConstants
|
import top.fatweb.api.constant.SecurityConstants
|
||||||
|
import top.fatweb.api.util.JwtUtil
|
||||||
|
|
||||||
@SpringBootTest
|
@ExtendWith(SpringExtension::class)
|
||||||
class FatWebApiApplicationTests {
|
class FatWebApiApplicationTests {
|
||||||
|
|
||||||
@Test
|
|
||||||
fun contextLoads() {
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
@Test
|
||||||
fun removePrefixTest() {
|
fun removePrefixTest() {
|
||||||
assertEquals("12312", "Bearer 12312".removePrefix(SecurityConstants.tokenPrefix))
|
assertEquals("12312", "Bearer 12312".removePrefix(SecurityConstants.tokenPrefix))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
fun jwtTest() {
|
||||||
|
val jwt = JwtUtil.createJwt("User")
|
||||||
|
assertEquals("User", jwt?.let { JwtUtil.parseJwt(it).subject })
|
||||||
|
}
|
||||||
|
|
||||||
/*
|
/*
|
||||||
@Test
|
@Test
|
||||||
fun addUser(@Autowired userService: IUserService, @Autowired passwordEncoder: PasswordEncoder) {
|
fun addUser(@Autowired userService: IUserService, @Autowired passwordEncoder: PasswordEncoder) {
|
||||||
|
|||||||
Reference in New Issue
Block a user