1. 修复 FileServiceTest 单元测试

2. 修复 FileConfigServiceImplTest 单元测试
This commit is contained in:
YunaiV 2022-11-11 08:48:25 +08:00
parent 123617a9af
commit cb4224af12
3 changed files with 5 additions and 3 deletions

View File

@ -214,12 +214,13 @@ public class FileConfigServiceImplTest extends BaseDbUnitTest {
// 测试 storage 不匹配 // 测试 storage 不匹配
fileConfigMapper.insert(cloneIgnoreId(dbFileConfig, o -> o.setStorage(FileStorageEnum.DB.getStorage()))); fileConfigMapper.insert(cloneIgnoreId(dbFileConfig, o -> o.setStorage(FileStorageEnum.DB.getStorage())));
// 测试 createTime 不匹配 // 测试 createTime 不匹配
fileConfigMapper.insert(cloneIgnoreId(dbFileConfig, o -> o.setCreateTime(LocalDateTimeUtil.parse("2020-01-23", DatePattern.NORM_DATE_PATTERN)))); fileConfigMapper.insert(cloneIgnoreId(dbFileConfig, o -> o.setCreateTime(LocalDateTimeUtil.parse("2020-11-23", DatePattern.NORM_DATE_PATTERN))));
// 准备参数 // 准备参数
FileConfigPageReqVO reqVO = new FileConfigPageReqVO(); FileConfigPageReqVO reqVO = new FileConfigPageReqVO();
reqVO.setName("芋道"); reqVO.setName("芋道");
reqVO.setStorage(FileStorageEnum.LOCAL.getStorage()); reqVO.setStorage(FileStorageEnum.LOCAL.getStorage());
reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2022, 11, 10),buildLocalDateTime(2022, 11, 12)})); reqVO.setCreateTime((new LocalDateTime[]{buildLocalDateTime(2020, 1, 1),
buildLocalDateTime(2020, 1, 24)}));
// 调用 // 调用
PageResult<FileConfigDO> pageResult = fileConfigService.getFileConfigPage(reqVO); PageResult<FileConfigDO> pageResult = fileConfigService.getFileConfigPage(reqVO);

View File

@ -91,7 +91,7 @@ public class FileServiceTest extends BaseDbUnitTest {
assertEquals(10L, file.getConfigId()); assertEquals(10L, file.getConfigId());
assertEquals(path, file.getPath()); assertEquals(path, file.getPath());
assertEquals(url, file.getUrl()); assertEquals(url, file.getUrl());
assertEquals("image/jpg", file.getType()); assertEquals("image/jpeg", file.getType());
assertEquals(content.length, file.getSize()); assertEquals(content.length, file.getSize());
} }

View File

@ -34,6 +34,7 @@ CREATE TABLE IF NOT EXISTS "infra_file_config" (
CREATE TABLE IF NOT EXISTS "infra_file" ( CREATE TABLE IF NOT EXISTS "infra_file" (
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY, "id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
"config_id" bigint NOT NULL, "config_id" bigint NOT NULL,
"name" varchar(256),
"path" varchar(512), "path" varchar(512),
"url" varchar(1024), "url" varchar(1024),
"type" varchar(63) DEFAULT NULL, "type" varchar(63) DEFAULT NULL,