Welcome to mirror list, hosted at ThFree Co, Russian Federation.

test.js « test - github.com/twbs/rfs.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 231e31ff060caeb31112ad6ace5c885fb23f63f1 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
/* eslint-env mocha */

'use strict';

const assert = require('assert').strict;
const result = require('./lib/result.js');
const tests = require('./tests.json');

const styles = [
  'Less',
  'Less3',
  'LibSass',
  'DartSass',
  'Stylus',
  'Postcss'
];

function doTest(style) {
  describe(style, () => {
    for (const { id, name } of tests) {
      it(name, done => {
        const generated = result[style.toLowerCase()](id);
        const expected = result.expected(id);

        if (generated instanceof Promise) {
          generated.then(generated => {
            assert.equal(generated, expected);
            done();
          }).catch(error => {
            done(error);
          });
        } else {
          assert.equal(generated, expected);
          done();
        }
      });
    }
  });
}

for (const style of styles) {
  doTest(style);
}