现在有的接口对接测试完成

This commit is contained in:
2026-07-25 19:19:36 +08:00
parent 8870136d1b
commit 817d85e117
59 changed files with 26623 additions and 1576 deletions
+30 -5
View File
@@ -5,6 +5,25 @@ const test = require('node:test');
const AuthPages = require('../public/js/auth-pages.js');
test('password login includes a verification token only when the PC strategy returns one', () => {
assert.deepEqual(
AuthPages.buildLoginBody({
phone: '13800000000',
password: 'plain-password',
validToken: 'captcha-ticket'
}, (value) => 'md5-' + value),
{
phone: '13800000000',
password: 'md5-plain-password',
validToken: 'captcha-ticket'
}
);
assert.deepEqual(
AuthPages.buildLoginBody({ phone: '13800000000', password: 'plain-password' }, (value) => 'md5-' + value),
{ phone: '13800000000', password: 'md5-plain-password' }
);
});
test('registration body carries the SMS code but never sends confirmation or captcha fields', () => {
assert.deepEqual(
AuthPages.buildRegisterBody({
@@ -40,11 +59,11 @@ test('password reset body carries only the reset DTO fields', () => {
);
});
test('authentication forms use the PC SMS scenes defined by the PC endpoint', () => {
assert.equal(AuthPages.getCaptchaScene('login'), 'PC_SMS_LOGIN');
assert.equal(AuthPages.getCaptchaScene('sms-login'), 'PC_SMS_LOGIN');
assert.equal(AuthPages.getCaptchaScene('register'), 'PC_REGISTER');
assert.equal(AuthPages.getCaptchaScene('password-reset'), 'PC_FORGOT_PASSWORD');
test('authentication forms use the PC verification operation codes defined by Apifox', () => {
assert.equal(AuthPages.getCaptchaOperation('login'), 'password-login');
assert.equal(AuthPages.getCaptchaOperation('sms-login'), 'sms-login');
assert.equal(AuthPages.getCaptchaOperation('register'), 'register');
assert.equal(AuthPages.getCaptchaOperation('password-reset'), 'forgot-password');
});
test('registration validates SMS code and password confirmation before submission', () => {
@@ -67,3 +86,9 @@ test('registration page exposes the documented SMS and confirmation inputs', ()
assert.match(source, /data-api-send-code/);
assert.match(source, /name="confirmPassword"/);
});
test('password login page retains a verification token field for the PC captcha strategy', () => {
const source = fs.readFileSync(path.join(__dirname, '..', 'login.html'), 'utf8');
assert.match(source, /id="login-password-form"[\s\S]*name="validToken"/);
});