This commit is contained in:
2026-08-12 19:51:33 +08:00
parent 6b1d97af04
commit 8a3f715a3b
7 changed files with 122 additions and 7 deletions
@@ -0,0 +1,34 @@
package com.baiyue.auth.repository;
import org.junit.jupiter.api.Test;
import org.springframework.core.io.ClassPathResource;
import java.nio.charset.StandardCharsets;
import java.nio.file.Files;
import java.nio.file.Path;
import static org.assertj.core.api.Assertions.assertThat;
class InitialAccountSeedSqlContractTest {
@Test
void initializesOnlyThePlatformAndItTestAdministratorAccounts() throws Exception {
assertAccountSeed(new ClassPathResource("db/phase1-admin-accounts.sql")
.getContentAsString(StandardCharsets.UTF_8));
assertAccountSeed(Files.readString(unifiedSql(), StandardCharsets.UTF_8));
}
private static void assertAccountSeed(String sql) {
assertThat(sql)
.contains("(1000001, 'platform_admin'")
.contains("'平台系统管理员', 'ACTIVE'")
.contains("(1000002, 'merchant_admin'")
.contains("'IT 测试客户管理员', 'ACTIVE'")
.contains("password_change_required")
.doesNotContain("一期演示企业管理员");
}
private static Path unifiedSql() {
Path path = Path.of("deploy", "sql", "头程数据库统一增量-MySQL8.sql");
return Files.exists(path) ? path : Path.of("..", "deploy", "sql", "头程数据库统一增量-MySQL8.sql");
}
}