summaryrefslogtreecommitdiff
path: root/packages/backend/test/unit/misc/others.ts
blob: 3bc134a2b8e7bd297e70093438b549636d3526cb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
/*
 * SPDX-FileCopyrightText: syuilo and misskey-project
 * SPDX-License-Identifier: AGPL-3.0-only
 */

import { describe, expect, test } from '@jest/globals';
import { contentDisposition } from '@/misc/content-disposition.js';

describe('misc:content-disposition', () => {
	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');
	});
});