chore: add demo profile and local api proxy

This commit is contained in:
王鹏
2026-07-07 17:08:46 +08:00
parent c2e46efdd9
commit d3840d621c
11 changed files with 362 additions and 3 deletions

View File

@@ -0,0 +1,43 @@
package com.linhelp.dev;
import com.linhelp.delivery.DeliveryUserService;
import com.linhelp.groupbuy.GroupBuyService;
import com.linhelp.notice.BannerService;
import com.linhelp.notice.NoticeService;
import com.linhelp.product.ProductService;
import com.linhelp.secondhand.SecondGoodsService;
import org.junit.jupiter.api.Test;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.context.SpringBootTest;
import static org.assertj.core.api.Assertions.assertThat;
@SpringBootTest(properties = {
"spring.flyway.enabled=false",
"spring.autoconfigure.exclude=org.springframework.boot.autoconfigure.jdbc.DataSourceAutoConfiguration"
})
class DevDataInitializerTests {
@Autowired
private ProductService productService;
@Autowired
private GroupBuyService groupBuyService;
@Autowired
private NoticeService noticeService;
@Autowired
private BannerService bannerService;
@Autowired
private SecondGoodsService secondGoodsService;
@Autowired
private DeliveryUserService deliveryUserService;
@Test
void seedsOneCommunityDemoDataForLocalTrial() {
assertThat(productService.listCategories(1L, true)).hasSize(6);
assertThat(productService.listMini(1L, null)).hasSizeGreaterThanOrEqualTo(10);
assertThat(groupBuyService.listMini(1L)).hasSize(1);
assertThat(noticeService.listPublished(1L)).hasSize(2);
assertThat(bannerService.listEnabled(1L)).hasSize(1);
assertThat(secondGoodsService.listPublic(1L, null)).hasSize(1);
assertThat(deliveryUserService.requireByUserId(3L).getName()).isEqualTo("配送员小林");
}
}