getLanguage.js 720 B

123456789101112131415161718192021222324252627282930
  1. 'use strict';
  2. let hljs = require('../../build');
  3. let should = require('should');
  4. describe('.getLanguage()', function() {
  5. it('should get an existing language', function() {
  6. const result = hljs.getLanguage('python');
  7. result.should.be.instanceOf(Object);
  8. });
  9. it('should be case insensitive', function() {
  10. const result = hljs.getLanguage('pYTHOn');
  11. result.should.be.instanceOf(Object);
  12. });
  13. it('should return undefined', function() {
  14. const result = hljs.getLanguage('-impossible-');
  15. should.strictEqual(result, undefined);
  16. });
  17. it('should not break on undefined', function() {
  18. const result = hljs.getLanguage(undefined);
  19. should.strictEqual(result, undefined);
  20. });
  21. });