|
| 1 | +'use babel'; |
| 2 | + |
| 3 | +import { SASSLINT_DOC_URL } from '../lib/constants.coffee'; |
| 4 | + |
| 5 | +const helpers = require('../lib/helpers.coffee'); |
| 6 | + |
| 7 | +describe('helpers', () => { |
| 8 | + describe('getRuleURI', () => { |
| 9 | + it('should return the correct rule URL', () => { |
| 10 | + const ruleId = 'no-ids'; |
| 11 | + const result = helpers.getRuleURI(ruleId); |
| 12 | + |
| 13 | + expect(result).toEqual(`${SASSLINT_DOC_URL}/${ruleId}.md`); |
| 14 | + }); |
| 15 | + }); |
| 16 | + |
| 17 | + describe('isValidSyntax', () => { |
| 18 | + it('should return true if a supported syntax is passed', () => { |
| 19 | + expect(helpers.isValidSyntax('scss')).toEqual(true); |
| 20 | + }); |
| 21 | + |
| 22 | + it('should return false if a supported syntax is not passed', () => { |
| 23 | + expect(helpers.isValidSyntax('html')).toEqual(false); |
| 24 | + }); |
| 25 | + }); |
| 26 | + |
| 27 | + describe('getFileSyntax', () => { |
| 28 | + it('it should return scss if a scss filename is provided', () => { |
| 29 | + expect(helpers.getFileSyntax('test/file.scss')).toEqual('scss'); |
| 30 | + }); |
| 31 | + |
| 32 | + it('it should return sass if a sass filename is provided', () => { |
| 33 | + expect(helpers.getFileSyntax('test/file.sass')).toEqual('sass'); |
| 34 | + }); |
| 35 | + |
| 36 | + it('it should return scss if a scss.liquid filename is provided', () => { |
| 37 | + expect(helpers.getFileSyntax('test/file.scss.liquid')).toEqual('scss'); |
| 38 | + }); |
| 39 | + |
| 40 | + it('it should return sass if a sass.liquid filename is provided', () => { |
| 41 | + expect(helpers.getFileSyntax('test/file.sass.liquid')).toEqual('sass'); |
| 42 | + }); |
| 43 | + |
| 44 | + it('it should return html if a html filename is provided', () => { |
| 45 | + expect(helpers.getFileSyntax('test/file.html')).toEqual('html'); |
| 46 | + }); |
| 47 | + }); |
| 48 | +}); |
0 commit comments