|
|
@@ -27,7 +27,7 @@ describe('用户供应商管理API集成测试', () => {
|
|
|
// 创建测试用户
|
|
|
const userRepository = dataSource.getRepository(UserEntity);
|
|
|
testUser = userRepository.create({
|
|
|
- username: `test_user_${Date.now()}`,
|
|
|
+ username: `test_user_${Math.floor(Math.random() * 100000)}`,
|
|
|
password: 'test_password',
|
|
|
nickname: '测试用户',
|
|
|
registrationSource: 'web'
|
|
|
@@ -36,7 +36,7 @@ describe('用户供应商管理API集成测试', () => {
|
|
|
|
|
|
// 创建其他用户
|
|
|
otherUser = userRepository.create({
|
|
|
- username: `other_user_${Date.now()}`,
|
|
|
+ username: `other_user_${Math.floor(Math.random() * 100000)}`,
|
|
|
password: 'other_password',
|
|
|
nickname: '其他用户',
|
|
|
registrationSource: 'web'
|
|
|
@@ -66,7 +66,7 @@ describe('用户供应商管理API集成测试', () => {
|
|
|
|
|
|
const userSupplier1 = supplierRepository.create({
|
|
|
name: '用户供应商1',
|
|
|
- username: `user_supplier1_${Date.now()}`,
|
|
|
+ username: `user_supplier1_${Math.floor(Math.random() * 100000)}`,
|
|
|
password: 'password123',
|
|
|
phone: '13800138001',
|
|
|
realname: '用户供应商1',
|
|
|
@@ -82,7 +82,7 @@ describe('用户供应商管理API集成测试', () => {
|
|
|
|
|
|
const userSupplier2 = supplierRepository.create({
|
|
|
name: '用户供应商2',
|
|
|
- username: `user_supplier2_${Date.now()}`,
|
|
|
+ username: `user_supplier2_${Math.floor(Math.random() * 100000)}`,
|
|
|
password: 'password123',
|
|
|
phone: '13800138002',
|
|
|
realname: '用户供应商2',
|
|
|
@@ -99,7 +99,7 @@ describe('用户供应商管理API集成测试', () => {
|
|
|
// 为其他用户创建一个供应商,确保不会返回
|
|
|
const otherUserSupplier = supplierRepository.create({
|
|
|
name: '其他用户供应商',
|
|
|
- username: `other_supplier_${Date.now()}`,
|
|
|
+ username: `other_supplier_${Math.floor(Math.random() * 100000)}`,
|
|
|
password: 'password123',
|
|
|
phone: '13800138003',
|
|
|
realname: '其他用户供应商',
|
|
|
@@ -148,7 +148,7 @@ describe('用户供应商管理API集成测试', () => {
|
|
|
it('应该成功创建供应商并自动使用当前用户ID', async () => {
|
|
|
const createData = {
|
|
|
name: '测试供应商',
|
|
|
- username: `test_supplier_${Date.now()}`,
|
|
|
+ username: `test_supplier_${Math.floor(Math.random() * 100000)}`,
|
|
|
password: 'password123',
|
|
|
phone: '13800138000',
|
|
|
realname: '测试供应商',
|
|
|
@@ -207,7 +207,7 @@ describe('用户供应商管理API集成测试', () => {
|
|
|
const supplierRepository = dataSource.getRepository(Supplier);
|
|
|
const testSupplier = supplierRepository.create({
|
|
|
name: '测试供应商详情',
|
|
|
- username: `test_supplier_detail_${Date.now()}`,
|
|
|
+ username: `test_supplier_detail_${Math.floor(Math.random() * 100000)}`,
|
|
|
password: 'password123',
|
|
|
phone: '13600136000',
|
|
|
realname: '测试供应商详情',
|
|
|
@@ -249,7 +249,7 @@ describe('用户供应商管理API集成测试', () => {
|
|
|
const supplierRepository = dataSource.getRepository(Supplier);
|
|
|
const otherUserSupplier = supplierRepository.create({
|
|
|
name: '其他用户供应商',
|
|
|
- username: `other_supplier_detail_${Date.now()}`,
|
|
|
+ username: `other_supplier_detail_${Math.floor(Math.random() * 100000)}`,
|
|
|
password: 'password123',
|
|
|
phone: '13600136001',
|
|
|
realname: '其他用户供应商',
|
|
|
@@ -296,7 +296,7 @@ describe('用户供应商管理API集成测试', () => {
|
|
|
const supplierRepository = dataSource.getRepository(Supplier);
|
|
|
const testSupplier = supplierRepository.create({
|
|
|
name: '原始供应商',
|
|
|
- username: `original_supplier_${Date.now()}`,
|
|
|
+ username: `original_supplier_${Math.floor(Math.random() * 100000)}`,
|
|
|
password: 'password123',
|
|
|
phone: '13500135000',
|
|
|
realname: '原始供应商',
|
|
|
@@ -344,7 +344,7 @@ describe('用户供应商管理API集成测试', () => {
|
|
|
const supplierRepository = dataSource.getRepository(Supplier);
|
|
|
const otherUserSupplier = supplierRepository.create({
|
|
|
name: '其他用户供应商',
|
|
|
- username: `other_supplier_update_${Date.now()}`,
|
|
|
+ username: `other_supplier_update_${Math.floor(Math.random() * 100000)}`,
|
|
|
password: 'password123',
|
|
|
phone: '13500135001',
|
|
|
realname: '其他用户供应商',
|
|
|
@@ -386,7 +386,7 @@ describe('用户供应商管理API集成测试', () => {
|
|
|
const supplierRepository = dataSource.getRepository(Supplier);
|
|
|
const testSupplier = supplierRepository.create({
|
|
|
name: '待删除供应商',
|
|
|
- username: `delete_supplier_${Date.now()}`,
|
|
|
+ username: `delete_supplier_${Math.floor(Math.random() * 100000)}`,
|
|
|
password: 'password123',
|
|
|
phone: '13400134000',
|
|
|
realname: '待删除供应商',
|
|
|
@@ -424,7 +424,7 @@ describe('用户供应商管理API集成测试', () => {
|
|
|
const supplierRepository = dataSource.getRepository(Supplier);
|
|
|
const otherUserSupplier = supplierRepository.create({
|
|
|
name: '其他用户供应商',
|
|
|
- username: `other_supplier_delete_${Date.now()}`,
|
|
|
+ username: `other_supplier_delete_${Math.floor(Math.random() * 100000)}`,
|
|
|
password: 'password123',
|
|
|
phone: '13400134001',
|
|
|
realname: '其他用户供应商',
|
|
|
@@ -460,7 +460,7 @@ describe('用户供应商管理API集成测试', () => {
|
|
|
|
|
|
const userSupplier = supplierRepository.create({
|
|
|
name: '用户供应商',
|
|
|
- username: `user_supplier_perm_${Date.now()}`,
|
|
|
+ username: `user_supplier_perm_${Math.floor(Math.random() * 100000)}`,
|
|
|
password: 'password123',
|
|
|
phone: '13800138004',
|
|
|
realname: '用户供应商',
|
|
|
@@ -476,7 +476,7 @@ describe('用户供应商管理API集成测试', () => {
|
|
|
|
|
|
const otherUserSupplier = supplierRepository.create({
|
|
|
name: '其他用户供应商',
|
|
|
- username: `other_supplier_perm_${Date.now()}`,
|
|
|
+ username: `other_supplier_perm_${Math.floor(Math.random() * 100000)}`,
|
|
|
password: 'password123',
|
|
|
phone: '13800138005',
|
|
|
realname: '其他用户供应商',
|
|
|
@@ -547,7 +547,7 @@ describe('用户供应商管理API集成测试', () => {
|
|
|
// 创建启用状态的供应商
|
|
|
const createData = {
|
|
|
name: '状态测试供应商',
|
|
|
- username: `status_test_supplier_${Date.now()}`,
|
|
|
+ username: `status_test_supplier_${Math.floor(Math.random() * 100000)}`,
|
|
|
password: 'password123',
|
|
|
phone: '13800138006',
|
|
|
realname: '状态测试供应商',
|
|
|
@@ -590,7 +590,7 @@ describe('用户供应商管理API集成测试', () => {
|
|
|
// 创建供应商
|
|
|
const createData = {
|
|
|
name: '登录统计供应商',
|
|
|
- username: `login_stat_supplier_${Date.now()}`,
|
|
|
+ username: `login_stat_supplier_${Math.floor(Math.random() * 100000)}`,
|
|
|
password: 'password123',
|
|
|
phone: '13800138007',
|
|
|
realname: '登录统计供应商',
|