Skip to content

Commit

Permalink
Add test for #65
Browse files Browse the repository at this point in the history
  • Loading branch information
sindresorhus committed Oct 23, 2022
1 parent a3b2f1e commit 12605f9
Showing 1 changed file with 12 additions and 0 deletions.
12 changes: 12 additions & 0 deletions test.js
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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),
Expand Down Expand Up @@ -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);
});

0 comments on commit 12605f9

Please sign in to comment.