mirror of
https://github.com/Redocly/redoc.git
synced 2025-08-04 20:30:23 +03:00
chore: add tests
This commit is contained in:
parent
dc91c054c8
commit
1c0b31415e
|
@ -13,6 +13,7 @@ import {
|
||||||
humanizeNumberRange,
|
humanizeNumberRange,
|
||||||
getContentWithLegacyExamples,
|
getContentWithLegacyExamples,
|
||||||
getDefinitionName,
|
getDefinitionName,
|
||||||
|
langFromMime,
|
||||||
} from '../';
|
} from '../';
|
||||||
|
|
||||||
import { FieldModel, OpenAPIParser, RedocNormalizedOptions } from '../../services';
|
import { FieldModel, OpenAPIParser, RedocNormalizedOptions } from '../../services';
|
||||||
|
@ -1320,4 +1321,18 @@ describe('Utils', () => {
|
||||||
expect(getDefinitionName()).toBeUndefined();
|
expect(getDefinitionName()).toBeUndefined();
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
describe('langFromMime', () => {
|
||||||
|
test('should return correct lang name from content type', () => {
|
||||||
|
expect(langFromMime('application/xml')).toEqual('xml');
|
||||||
|
expect(langFromMime('application/x-xml')).toEqual('xml');
|
||||||
|
expect(langFromMime('application/csv')).toEqual('csv');
|
||||||
|
expect(langFromMime('application/x-csv')).toEqual('csv');
|
||||||
|
expect(langFromMime('text/plain')).toEqual('tex');
|
||||||
|
expect(langFromMime('text/x-plain')).toEqual('tex');
|
||||||
|
expect(langFromMime('application/plain')).toEqual('tex');
|
||||||
|
|
||||||
|
expect(langFromMime('text/some-type')).toEqual('clike');
|
||||||
|
});
|
||||||
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in New Issue
Block a user