补强静态发布安全边界
This commit is contained in:
@@ -127,4 +127,52 @@ describe('Works Square submission binding store', () => {
|
||||
review_status: 'approved',
|
||||
});
|
||||
});
|
||||
|
||||
it.each([
|
||||
['submitted without a version id', {
|
||||
status: 'submitted',
|
||||
app_id: 'planet-game',
|
||||
version_name: 'v0.7.0',
|
||||
}],
|
||||
['retired without its fixed error code', {
|
||||
status: 'legacy_retired',
|
||||
message: '请重新提交',
|
||||
}],
|
||||
])('rejects a malformed schema 2 record: %s', async (_case, fields) => {
|
||||
const project = await createProject();
|
||||
await writeFile(
|
||||
join(project.path, WORKS_SUBMISSION_BINDING_FILE_NAME),
|
||||
`${JSON.stringify({
|
||||
schema_version: WORKS_SUBMISSION_BINDING_SCHEMA_VERSION,
|
||||
project_id: project.id,
|
||||
requested_at: '2026-08-10T00:00:00.000Z',
|
||||
updated_at: '2026-08-10T00:05:00.000Z',
|
||||
...fields,
|
||||
})}\n`,
|
||||
'utf8',
|
||||
);
|
||||
|
||||
await expect(readWorksSubmissionBinding(project.path, project.id)).resolves.toBeNull();
|
||||
});
|
||||
|
||||
it('rejects a copied binding whose project id does not match the current project', async () => {
|
||||
const project = await createProject();
|
||||
await writeFile(
|
||||
join(project.path, WORKS_SUBMISSION_BINDING_FILE_NAME),
|
||||
`${JSON.stringify({
|
||||
schema_version: WORKS_SUBMISSION_BINDING_SCHEMA_VERSION,
|
||||
project_id: 'another-project',
|
||||
status: 'submitted',
|
||||
requested_at: '2026-08-10T00:00:00.000Z',
|
||||
updated_at: '2026-08-10T00:05:00.000Z',
|
||||
app_id: 'planet-game',
|
||||
version_id: 'version-7',
|
||||
version_name: 'v0.7.0',
|
||||
})}\n`,
|
||||
'utf8',
|
||||
);
|
||||
const store = createWorksSubmissionBindingStore(createStore(project));
|
||||
|
||||
await expect(store.get(project.id)).resolves.toBeNull();
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user