From 12605f97f3be2f4ebc4b0d4a9078a165a8680c95 Mon Sep 17 00:00:00 2001 From: Sindre Sorhus Date: Sun, 23 Oct 2022 18:43:54 +0700 Subject: [PATCH] Add test for #65 --- test.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/test.js b/test.js index 15dc40d..69fd1c3 100644 --- a/test.js +++ b/test.js @@ -21,6 +21,7 @@ const name = { qux: 'qux.js', fileLink: 'file-link', directoryLink: 'directory-link', + dotDirectory: '.git', }; // These paths are relative to the project root @@ -48,6 +49,7 @@ absolute.barDir = path.join(absolute.fixtureDirectory, name.fooDirectory, name.b absolute.barDirQux = path.join(absolute.fixtureDirectory, name.fooDirectory, name.barDirectory, name.qux); absolute.fileLink = path.join(absolute.fixtureDirectory, name.fileLink); absolute.directoryLink = path.join(absolute.fixtureDirectory, name.directoryLink); +absolute.dotDirectory = path.join(__dirname, name.dotDirectory); const url = { fixtureDirectory: pathToFileURL(absolute.fixtureDirectory), @@ -652,3 +654,13 @@ test('sync (check if path exists)', t => { t.true(pathExistsSync(absolute.packageJson)); t.false(pathExistsSync('fake')); }); + +test('async (dot file)', async t => { + const foundPath = await findUp(name.dotDirectory, {type: 'directory'}); + t.is(foundPath, absolute.dotDirectory); +}); + +test('sync (dot file)', async t => { + const foundPath = await findUp(name.dotDirectory, {type: 'directory'}); + t.is(foundPath, absolute.dotDirectory); +});