mirror of
https://activitypub.software/TransFem-org/Sharkey
synced 2024-12-20 23:40:10 +00:00
0a8ffd9cfa
* maybe ok * fix * test wip * ✌️ * fix * if (res.ok) * validateContentTypeSetAsJsonLD * 条件を考慮し直す * その他の+json接尾辞が付いているメディアタイプも受け容れる * https://github.com/misskey-dev/misskey-ghsa-qqrm-9grj-6v32/pull/1#discussion_r1490999009 * add `; profile="https://www.w3.org/ns/activitystreams"` * application/ld+json;
40 lines
1.2 KiB
TypeScript
40 lines
1.2 KiB
TypeScript
/*
|
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
*/
|
|
|
|
process.env.NODE_ENV = 'test';
|
|
|
|
import { validateContentTypeSetAsActivityPub, validateContentTypeSetAsJsonLD } from '@/core/activitypub/misc/validator.js';
|
|
import { signup, uploadFile, relativeFetch } from '../utils.js';
|
|
import type * as misskey from 'misskey-js';
|
|
|
|
describe('validateContentTypeSetAsActivityPub/JsonLD (deny case)', () => {
|
|
let alice: misskey.entities.SignupResponse;
|
|
let aliceUploadedFile: any;
|
|
|
|
beforeAll(async () => {
|
|
alice = await signup({ username: 'alice' });
|
|
aliceUploadedFile = await uploadFile(alice);
|
|
}, 1000 * 60 * 2);
|
|
|
|
test('ActivityStreams: ファイルはエラーになる', async () => {
|
|
const res = await relativeFetch(aliceUploadedFile.webpublicUrl);
|
|
|
|
function doValidate() {
|
|
validateContentTypeSetAsActivityPub(res);
|
|
}
|
|
|
|
expect(doValidate).toThrow('Content type is not');
|
|
});
|
|
|
|
test('JSON-LD: ファイルはエラーになる', async () => {
|
|
const res = await relativeFetch(aliceUploadedFile.webpublicUrl);
|
|
|
|
function doValidate() {
|
|
validateContentTypeSetAsJsonLD(res);
|
|
}
|
|
|
|
expect(doValidate).toThrow('Content type is not');
|
|
});
|
|
});
|