1. 修复 FileServiceTest 单元测试

2. 修复 FileConfigServiceImplTest 单元测试
This commit is contained in:
YunaiV 2022-11-11 08:48:33 +08:00
parent 6ed88db8a4
commit 8c4332f47d
3 changed files with 5 additions and 3 deletions

View File

@ -214,12 +214,13 @@ public class FileConfigServiceImplTest extends BaseDbUnitTest {
// 测试 storage 不匹配
fileConfigMapper.insert(cloneIgnoreId(dbFileConfig, o -> o.setStorage(FileStorageEnum.DB.getStorage())));
// 测试 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();
reqVO.setName("芋道");
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);

View File

@ -90,7 +90,7 @@ public class FileServiceTest extends BaseDbUnitTest {
assertEquals(10L, file.getConfigId());
assertEquals(path, file.getPath());
assertEquals(url, file.getUrl());
assertEquals("image/jpg", file.getType());
assertEquals("image/jpeg", file.getType());
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" (
"id" bigint NOT NULL GENERATED BY DEFAULT AS IDENTITY,
"config_id" bigint NOT NULL,
"name" varchar(256),
"path" varchar(512),
"url" varchar(1024),
"type" varchar(63) DEFAULT NULL,