From 2e0bad15dfbfae1daa252b21dc6eabef2ef3cbc0 Mon Sep 17 00:00:00 2001 From: Eric Clemmons Date: Mon, 7 Nov 2016 21:17:57 -0600 Subject: [PATCH 1/2] Add test for loaders.js --- src/default_config/tests/loaders.js | 39 +++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 src/default_config/tests/loaders.js diff --git a/src/default_config/tests/loaders.js b/src/default_config/tests/loaders.js new file mode 100644 index 0000000..a4197ad --- /dev/null +++ b/src/default_config/tests/loaders.js @@ -0,0 +1,39 @@ +import { expect } from 'chai'; +import { describe, it } from 'mocha'; + +import loaders from '../loaders'; + +const returnArg = arg => arg; +const returnNull = () => null; + +const expecteds = { + jpg: returnArg, + png: returnArg, + gif: returnArg, + eot: returnArg, + svg: returnArg, + ttf: returnArg, + woff: returnArg, + woff2: returnArg, + css: returnNull, + scss: returnNull, + sass: returnNull, +}; + +describe('loaders', () => { + const exts = Object.keys(expecteds); + + expect(loaders).to.have.all.keys(exts); + + exts.forEach((ext) => { + describe(`.${ext}`, () => { + const expected = expecteds[ext]('test'); + + it(`should return "${expected}"`, () => { + const actual = loaders[ext]('test'); + + expect(actual).to.equal(expected); + }); + }); + }); +}); From 41fdad47516cf329fb529de25054fd433ca3bfcb Mon Sep 17 00:00:00 2001 From: Eric Clemmons Date: Mon, 7 Nov 2016 21:19:22 -0600 Subject: [PATCH 2/2] Default loaders.js mocks .md, .mdown, & .markdown --- src/default_config/loaders.js | 2 +- src/default_config/tests/loaders.js | 3 +++ 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/src/default_config/loaders.js b/src/default_config/loaders.js index a6ae943..36a6c07 100644 --- a/src/default_config/loaders.js +++ b/src/default_config/loaders.js @@ -1,4 +1,4 @@ -const fileExts = ['jpg', 'png', 'gif', 'eot', 'svg', 'ttf', 'woff', 'woff2']; +const fileExts = ['jpg', 'png', 'gif', 'eot', 'svg', 'ttf', 'woff', 'woff2', 'md', 'mdown', 'markdown']; const moduleExts = ['css', 'scss', 'sass']; const loaders = {}; diff --git a/src/default_config/tests/loaders.js b/src/default_config/tests/loaders.js index a4197ad..7d4e5d2 100644 --- a/src/default_config/tests/loaders.js +++ b/src/default_config/tests/loaders.js @@ -15,6 +15,9 @@ const expecteds = { ttf: returnArg, woff: returnArg, woff2: returnArg, + md: returnArg, + mdown: returnArg, + markdown: returnArg, css: returnNull, scss: returnNull, sass: returnNull,