forked from wangziqi/gongxue-base
test: require launch persona evidence
This commit is contained in:
@@ -96,6 +96,25 @@ const gateChecks = [
|
||||
includeWrites: true,
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'api.launch-persona-smoke',
|
||||
label: 'Real API launch persona journey smoke',
|
||||
commandIncludes: 'smoke:launch-persona',
|
||||
summary: {
|
||||
status: 'pass',
|
||||
'student.status': 'pass',
|
||||
'student.result.entitlement.isSvip': true,
|
||||
'student.result.practice.questionCount': { gte: 1 },
|
||||
'student.result.favorite.favoriteCount': { gte: 1 },
|
||||
'student.result.favorite.reviewSessionId': { truthy: true },
|
||||
'student.result.wrongReview.reviewPlanCount': { gte: 0 },
|
||||
'tenantAdmin.status': 'pass',
|
||||
'tenantAdmin.result.guards.studentDashboardDenied': { oneOf: ['TENANT_MEMBER_REQUIRED', 'TENANT_PERMISSION_DENIED', 'FORBIDDEN'] },
|
||||
'tenantAdmin.result.guards.crossTenantDenied': { oneOf: ['TENANT_MEMBER_REQUIRED', 'TENANT_PERMISSION_DENIED', 'FORBIDDEN'] },
|
||||
'platformAdmin.status': 'pass',
|
||||
'platformAdmin.result.guards.studentPlatformDenied': { oneOf: ['PLATFORM_ADMIN_REQUIRED', 'FORBIDDEN'] },
|
||||
},
|
||||
},
|
||||
{
|
||||
id: 'api.integration',
|
||||
label: 'API integration regression',
|
||||
@@ -342,7 +361,7 @@ function compareSummary(actualSummary, expectedSummary) {
|
||||
|
||||
function isComparatorSpec(value) {
|
||||
if (!value || typeof value !== 'object' || Array.isArray(value)) return false;
|
||||
return ['eq', 'lt', 'lte', 'gt', 'gte', 'oneOf'].some(key => Object.prototype.hasOwnProperty.call(value, key));
|
||||
return ['eq', 'lt', 'lte', 'gt', 'gte', 'oneOf', 'truthy'].some(key => Object.prototype.hasOwnProperty.call(value, key));
|
||||
}
|
||||
|
||||
function compareExpectedValue(actualValue, expectedValue) {
|
||||
@@ -362,6 +381,12 @@ function compareExpectedValue(actualValue, expectedValue) {
|
||||
return `expected one of ${JSON.stringify(choices)} but got ${JSON.stringify(actualValue)}`;
|
||||
}
|
||||
}
|
||||
if (Object.prototype.hasOwnProperty.call(expectedValue, 'truthy')) {
|
||||
const shouldBeTruthy = Boolean(expectedValue.truthy);
|
||||
if (Boolean(actualValue) !== shouldBeTruthy) {
|
||||
return `expected ${shouldBeTruthy ? 'truthy' : 'falsy'} but got ${JSON.stringify(actualValue)}`;
|
||||
}
|
||||
}
|
||||
|
||||
const numericChecks = [
|
||||
['lt', (actual, expected) => actual < expected, '<'],
|
||||
|
||||
Reference in New Issue
Block a user