MCPcopy
hub / github.com/node-formidable/formidable / testNext

Function testNext

test/integration/fixtures.test.js:50–88  ·  view source on GitHub ↗
(results)

Source from the content-addressed store, hash-verified

48 }
49
50 function testNext(results) {
51 const fixtureWithName = results.shift();
52 if (!fixtureWithName) {
53 server.close();
54 done();
55 return;
56 }
57 const fixtureName = fixtureWithName.name;
58 const fixture = fixtureWithName.fixture;
59
60 uploadFixture(fixtureName, (err, parts) => {
61 if (err) {
62 err.fixtureName = fixtureName;
63 throw err;
64 }
65
66 fixture.forEach((expectedPart, i) => {
67 const parsedPart = parts[i];
68 strictEqual(parsedPart.type, expectedPart.type);
69 strictEqual(parsedPart.name, expectedPart.name);
70
71 if (parsedPart.type === 'file') {
72 const file = parsedPart.value;
73 strictEqual(file.originalFilename, expectedPart.originalFilename,
74 `${JSON.stringify([expectedPart, file])}`);
75
76 if (expectedPart.sha1) {
77 strictEqual(
78 file.hash,
79 expectedPart.sha1,
80 `SHA1 error ${file.originalFilename} on ${file.filepath} ${JSON.stringify([expectedPart, file])}`,
81 );
82 }
83 }
84 });
85
86 testNext(results);
87 });
88 }
89
90 function uploadFixture(fixtureName, cb) {
91 server.once('request', (req, res) => {

Callers 1

findFixturesFunction · 0.85

Calls 2

doneFunction · 0.85
uploadFixtureFunction · 0.85

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…