+ describe('parseContentType', function () {
+ it('handles no data', function () {
+ const expected = {
+ mediaType: 'application/octet-stream',
+ params: {},
+ };
+ const result = LinkHelper.parseContentType();
+ assert.deepStrictEqual(result, expected);
+ });
+ it('handles only media type', function () {
+ const expected = {
+ mediaType: 'application/json',
+ params: {},
+ };
+ const result = LinkHelper.parseContentType('application/json');
+ assert.deepStrictEqual(result, expected);
+ });
+ it('handles parameters', function () {
+ const expected = {
+ mediaType: 'text/html',
+ params: {
+ charset: 'ISO-8859-4',
+ },
+ };
+ const result = LinkHelper.parseContentType('text/html; charset=ISO-8859-4');
+ assert.deepStrictEqual(result, expected);
+ });
+ it('handles more parameters', function () {
+ const expected = {
+ mediaType: 'multipart/form-data',
+ params: {
+ boundary: '--123--',
+ other: 'foo',
+ },
+ };
+ const result = LinkHelper.parseContentType('multipart/form-data; boundary="--123--"; other=foo');
+ assert.deepStrictEqual(result, expected);
+ });
+ }); // parseContentType
+