{"size": 1127, "ext": "js", "max_stars_repo_path": "test.js", "max_stars_repo_name": "Silicon-Beach-Labs/decode-uri-component", "max_stars_repo_stars_event_min_datetime": "2017-05-20T15:06:14.000Z", "max_stars_repo_stars_event_max_datetime": "2022-02-15T13:15:09.000Z", "max_issues_repo_path": "test.js", "max_issues_repo_name": "Silicon-Beach-Labs/decode-uri-component", "max_issues_repo_issues_event_min_datetime": "2018-12-04T06:37:06.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-20T20:19:38.000Z", "max_forks_repo_path": "test.js", "max_forks_repo_name": "Silicon-Beach-Labs/decode-uri-component", "max_forks_repo_forks_event_min_datetime": "2018-01-31T02:01:31.000Z", "max_forks_repo_forks_event_max_datetime": "2020-07-01T21:00:05.000Z"}
{"max_stars_count": 100, "max_issues_count": 4, "max_forks_count": 14, "avg_line_length": 22.0980392157, "max_line_length": 84, "alphanum_fraction": 0.4853593611}
import test from 'ava';
import m from './';

const tests = {
	'test': 'test',
	'a+b': 'a b',
	'a+b+c+d': 'a b c d',
	'=a': '=a',
	'%': '%',
	'%25': '%',
	'%%25%%': '%%%%',
	'st%C3%A5le': 'ståle',
	'st%C3%A5le%': 'ståle%',
	'%st%C3%A5le%': '%ståle%',
	'%%7Bst%C3%A5le%7D%': '%{ståle}%',
	'%ab%C3%A5le%': '%abåle%',
	'%C3%A5%able%': 'å%able%',
	'%7B%ab%7C%de%7D': '{%ab|%de}',
	'%7B%ab%%7C%de%%7D': '{%ab%|%de%}',
	'%7 B%ab%%7C%de%%7 D': '%7 B%ab%|%de%%7 D',
	'%ab': '%ab',
	'%ab%ab%ab': '%ab%ab%ab',
	'%61+%4d%4D': 'a MM',
	'\uFEFFtest': '\uFEFFtest',
	'\uFEFF': '\uFEFF',
	'%EF%BB%BFtest': '\uFEFFtest',
	'%EF%BB%BF': '\uFEFF',
	'%FE%FF': '\uFFFD\uFFFD',
	'%FF%FE': '\uFFFD\uFFFD',
	'†': '†',
	'%C2': '\uFFFD',
	'%C2x': '\uFFFDx',
	'%C2%B5': 'µ',
	'%C2%B5%': 'µ%',
	'%%C2%B5%': '%µ%'
};

function macro(t, input, expected) {
	t.is(m(input), expected);
}

macro.title = (providedTitle, input, expected) => `${input} → ${expected}`;

test('type error', t => {
	t.throws(() => m(5), 'Expected `encodedURI` to be of type `string`, got `number`');
});

for (const input of Object.keys(tests)) {
	test(macro, input, tests[input]);
}
