Skip to content

Commit 3619461

Browse files
authored
Add dotfile to integration test (#217)
* Add dotfile to integration test * Make unit test look at the actual files instead of just length * Is the test working now?
1 parent 1253ca1 commit 3619461

File tree

3 files changed

+14
-3
lines changed

3 files changed

+14
-3
lines changed

tests/test-node-func/.dotfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
I exist!

tests/test-node-func/index.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,17 @@
44
* @param {!express:Request} req HTTP request context.
55
* @param {!express:Response} res HTTP response context.
66
*/
7+
8+
let fs = require('fs');
9+
710
exports.helloWorld = (req, res) => {
11+
// Still send a 200 so we get the response (gaxios and other libraries barf on
12+
// non-200)
13+
if (!fs.existsSync('.dotfile')) {
14+
res.status(200).send('Dotfile does not exist!');
15+
return;
16+
}
17+
818
let message = req.query.message || req.body.message || 'Hello World!!';
919
res.status(200).send(message);
1020
};

tests/util.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -421,7 +421,7 @@ describe('Zip', function () {
421421
const filesInsideZip = await getFilesInZip(zf);
422422
const expectedFiles = getNonIgnoredFiles(testDirNoIgnore, testDirNoIgnore);
423423

424-
expect(await filesInsideZip.length).equal(expectedFiles.length);
424+
expect(filesInsideZip).eql(expectedFiles);
425425
filesInsideZip.forEach((f) => expect(expectedFiles).to.include(f));
426426
});
427427

@@ -437,7 +437,7 @@ describe('Zip', function () {
437437
new Set(['ignore.txt', '.gcloudignore']),
438438
);
439439

440-
expect(await filesInsideZip.length).equal(expectedFiles.length);
440+
expect(filesInsideZip).eql(expectedFiles);
441441
filesInsideZip.forEach((f) => expect(expectedFiles).to.include(f));
442442
});
443443

@@ -453,7 +453,7 @@ describe('Zip', function () {
453453
new Set(['bar/bar.txt', 'bar/baz/baz.txt']),
454454
);
455455

456-
expect(await filesInsideZip.length).equal(expectedFiles.length);
456+
expect(filesInsideZip).eql(expectedFiles);
457457
filesInsideZip.forEach((f) => expect(expectedFiles).to.include(f));
458458
});
459459
});

0 commit comments

Comments
 (0)