(testName, useResources)
| 51 | } |
| 52 | |
| 53 | function runCase(testName, useResources) { |
| 54 | const base = __dirname + '/cases/' + testName; |
| 55 | const html = read(base + '.html'); |
| 56 | const css = read(base + '.css'); |
| 57 | const rawConfig = read(base + '.json'); |
| 58 | const config = rawConfig ? JSON.parse(rawConfig) : null; |
| 59 | |
| 60 | return () => new Promise((resolve, reject) => { |
| 61 | const onJuiced = (err, actual) => { |
| 62 | if (err) return reject(err); |
| 63 | const expected = read(base + '.out'); |
| 64 | try { |
| 65 | expect(utils.normalizeLineEndings(actual.trim())) |
| 66 | .toBe(utils.normalizeLineEndings(expected.trim())); |
| 67 | resolve(); |
| 68 | } catch (err) { |
| 69 | reject(err); |
| 70 | } |
| 71 | }; |
| 72 | |
| 73 | if (!useResources) { |
| 74 | onJuiced(null, juice.inlineContent(html, css, config)); |
| 75 | } else { |
| 76 | juice.juiceResources(html, config, onJuiced); |
| 77 | } |
| 78 | }); |
| 79 | } |
no test coverage detected
searching dependent graphs…