Skip to content

Commit

Permalink
chore(tests): correct some tests due to last feature for CSSModules
Browse files Browse the repository at this point in the history
  • Loading branch information
Kocal committed Mar 1, 2019
1 parent 4dbe443 commit 9dd6ca4
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions test/config-generator.js
Original file line number Diff line number Diff line change
Expand Up @@ -1089,55 +1089,55 @@ describe('The config-generator function', () => {
it('configure rule for "sass"', () => {
config.enableSassLoader();
config.configureLoaderRule('sass', (loaderRule) => {
loaderRule.use[2].options.fooBar = 'fooBar';
loaderRule.oneOf[1].use[2].options.fooBar = 'fooBar';
});

const webpackConfig = configGenerator(config);
const rule = findRule(/\.s[ac]ss$/, webpackConfig.module.rules);

expect(rule.use[2].options.fooBar).to.equal('fooBar');
expect(rule.oneOf[1].use[2].options.fooBar).to.equal('fooBar');
});

it('configure rule for the alias "scss"', () => {
config.enableSassLoader();
config.configureLoaderRule('scss', (loaderRule) => {
loaderRule.use[2].options.fooBar = 'fooBar';
loaderRule.oneOf[1].use[2].options.fooBar = 'fooBar';
});

const webpackConfig = configGenerator(config);
const rule = findRule(/\.s[ac]ss$/, webpackConfig.module.rules);

expect(rule.use[2].options.fooBar).to.equal('fooBar');
expect(rule.oneOf[1].use[2].options.fooBar).to.equal('fooBar');
});

it('configure rule for "less"', () => {
config.enableLessLoader((options) => {
options.optionA = 'optionA';
});
config.configureLoaderRule('less', (loaderRule) => {
loaderRule.use[2].options.optionB = 'optionB';
loaderRule.oneOf[1].use[2].options.optionB = 'optionB';
});

const webpackConfig = configGenerator(config);
const rule = findRule(/\.less/, webpackConfig.module.rules);

expect(rule.use[2].options.optionA).to.equal('optionA');
expect(rule.use[2].options.optionB).to.equal('optionB');
expect(rule.oneOf[1].use[2].options.optionA).to.equal('optionA');
expect(rule.oneOf[1].use[2].options.optionB).to.equal('optionB');
});

it('configure rule for "stylus"', () => {
config.enableStylusLoader((options) => {
options.optionA = 'optionA';
});
config.configureLoaderRule('stylus', (loaderRule) => {
loaderRule.use[2].options.optionB = 'optionB';
loaderRule.oneOf[1].use[2].options.optionB = 'optionB';
});

const webpackConfig = configGenerator(config);
const rule = findRule(/\.styl/, webpackConfig.module.rules);

expect(rule.use[2].options.optionA).to.equal('optionA');
expect(rule.use[2].options.optionB).to.equal('optionB');
expect(rule.oneOf[1].use[2].options.optionA).to.equal('optionA');
expect(rule.oneOf[1].use[2].options.optionB).to.equal('optionB');
});

it('configure rule for "vue"', () => {
Expand Down

0 comments on commit 9dd6ca4

Please sign in to comment.