diff --git a/test/index.test.js b/test/index.test.js index 7595f086..3a6d211b 100644 --- a/test/index.test.js +++ b/test/index.test.js @@ -160,6 +160,24 @@ test('should prepend data', async () => { expect(css).toEqual('.background {\n color: red;\n}\n'); }); +test('should prepend data', async () => { + const loaderOptions = { + prependData: `@background: red;`, + }; + + let inspect; + + const rules = moduleRules.basic(loaderOptions, {}, (i) => { + inspect = i; + }); + + await compile('prepend-data', rules).catch((e) => e); + + const [css] = inspect.arguments; + + expect(css).toEqual('.background {\n color: red;\n}\n'); +}); + test('should append data', async () => { const loaderOptions = { appendData() { @@ -180,6 +198,24 @@ test('should append data', async () => { expect(css).toEqual('.background {\n color: coral;\n}\n'); }); +test('should append data', async () => { + const loaderOptions = { + appendData: `@color1: coral;`, + }; + + let inspect; + + const rules = moduleRules.basic(loaderOptions, {}, (i) => { + inspect = i; + }); + + await compile('append-data', rules).catch((e) => e); + + const [css] = inspect.arguments; + + expect(css).toEqual('.background {\n color: coral;\n}\n'); +}); + test('should allow a function to be passed through for `lessOptions`', async () => { await compileAndCompare('import-paths', { lessLoaderOptions: {