2023-07-27 14:31:52 +09:00
|
|
|
/*
|
2024-02-14 00:59:27 +09:00
|
|
|
* SPDX-FileCopyrightText: syuilo and misskey-project
|
2023-07-27 14:31:52 +09:00
|
|
|
* SPDX-License-Identifier: AGPL-3.0-only
|
|
|
|
*/
|
|
|
|
|
2024-01-08 17:43:52 +09:00
|
|
|
import { describe, expect, test } from '@jest/globals';
|
2023-03-04 16:51:07 +09:00
|
|
|
import { contentDisposition } from '@/misc/content-disposition.js';
|
|
|
|
|
|
|
|
describe('misc:content-disposition', () => {
|
2023-07-27 14:31:52 +09:00
|
|
|
test('inline', () => {
|
|
|
|
expect(contentDisposition('inline', 'foo bar')).toBe('inline; filename=\"foo_bar\"; filename*=UTF-8\'\'foo%20bar');
|
|
|
|
});
|
|
|
|
test('attachment', () => {
|
|
|
|
expect(contentDisposition('attachment', 'foo bar')).toBe('attachment; filename=\"foo_bar\"; filename*=UTF-8\'\'foo%20bar');
|
|
|
|
});
|
|
|
|
test('non ascii', () => {
|
|
|
|
expect(contentDisposition('attachment', 'ファイル名')).toBe('attachment; filename=\"_____\"; filename*=UTF-8\'\'%E3%83%95%E3%82%A1%E3%82%A4%E3%83%AB%E5%90%8D');
|
|
|
|
});
|
2023-03-04 16:51:07 +09:00
|
|
|
});
|