|
| 1 | +import test from 'ava'; |
| 2 | +import path from 'path'; |
| 3 | +import fs from 'fs-extra'; |
| 4 | +import rcsCore from 'rcs-core'; |
| 5 | + |
| 6 | +import rcs from '../'; |
| 7 | + |
| 8 | +const testCwd = 'test/files/testCache'; |
| 9 | +const fixturesCwd = 'test/files/fixtures'; |
| 10 | + |
| 11 | +test.beforeEach(() => { |
| 12 | + rcsCore.nameGenerator.setAlphabet('#abcdefghijklmnopqrstuvwxyz'); |
| 13 | + rcsCore.nameGenerator.reset(); |
| 14 | + rcsCore.selectorLibrary.reset(); |
| 15 | + rcsCore.keyframesLibrary.reset(); |
| 16 | +}); |
| 17 | + |
| 18 | +test.afterEach.always(() => { |
| 19 | + fs.removeSync(testCwd); |
| 20 | +}); |
| 21 | + |
| 22 | +test.cb('issue #19 | detect one file as array', (t) => { |
| 23 | + rcs.process.css('**/style.css', { |
| 24 | + newPath: testCwd, |
| 25 | + cwd: fixturesCwd, |
| 26 | + }, () => { |
| 27 | + rcs.process.html(['html/index.html'], { |
| 28 | + newPath: testCwd, |
| 29 | + cwd: fixturesCwd, |
| 30 | + }, (err) => { |
| 31 | + t.falsy(err); |
| 32 | + t.true(fs.existsSync(path.join(testCwd, '/html/index.html'))); |
| 33 | + t.true(fs.existsSync(path.join(testCwd, '/css/style.css'))); |
| 34 | + t.true(fs.existsSync(path.join(testCwd, '/css/subdirectory/style.css'))); |
| 35 | + t.end(); |
| 36 | + }); |
| 37 | + }); |
| 38 | +}); |
| 39 | + |
| 40 | +test.cb('issue #19 | detect one file', (t) => { |
| 41 | + rcs.process.css('**/style.css', { |
| 42 | + newPath: testCwd, |
| 43 | + cwd: fixturesCwd, |
| 44 | + }, () => { |
| 45 | + rcs.process.html('html/index.html', { |
| 46 | + newPath: testCwd, |
| 47 | + cwd: fixturesCwd, |
| 48 | + }, (err) => { |
| 49 | + t.falsy(err); |
| 50 | + t.true(fs.existsSync(path.join(testCwd, '/html/index.html'))); |
| 51 | + t.true(fs.existsSync(path.join(testCwd, '/css/style.css'))); |
| 52 | + t.true(fs.existsSync(path.join(testCwd, '/css/subdirectory/style.css'))); |
| 53 | + t.end(); |
| 54 | + }); |
| 55 | + }); |
| 56 | +}); |
0 commit comments