我正在为一个公共API构建请求注册端点的单元测试,而不是我的. 我正在和柴一起工作,这是一段代码: it('should return register information', function(done) { let data = { User: { Name: 'test', Email: 'test@
我正在和柴一起工作,这是一段代码:
it('should return register information', function(done) { let data = { User: { Name: 'test', Email: 'test@test.com', CellPhone: '666777888', Password: '123456789' } }; testApi.register(data).then(res => { ... });
也许有些图书馆?
试试 fackerconst faker = require('facker'); it('should return register information', function(done) { let data = { User: { Name: faker.name.findName(), Email: faker.internet.email(), CellPhone: faker.phone.phoneNumber(), Password: '123456789' } }; testApi.register(data).then(res => { ... });