MCPcopy
hub / github.com/Automattic/juice / runCase

Function runCase

test/cases.test.js:53–79  ·  view source on GitHub ↗
(testName, useResources)

Source from the content-addressed store, hash-verified

51}
52
53function 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}

Callers 1

cases.test.jsFile · 0.85

Calls 4

readFunction · 0.85
onJuicedFunction · 0.85
inlineContentMethod · 0.80
juiceResourcesMethod · 0.80

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…