Skip to content

Commit

Permalink
test: add 'get the trash path using a dangling symlink on a mounted d…
Browse files Browse the repository at this point in the history
…rive'

A future commit should fix this :-).  Here is the failing test result:

  /home/alan-sysop/src/npm-packages/xdg-trashdir/test/test.js:56

   55:     const dir = await trashdir(filename);
   56:     t.is(dirname, dir);
   57:

  Difference:

  - '/home/alan-sysop/src/npm-packages/xdg-trashdir/test/test-disk2/.Trash-1000'
  + '/home/alan-sysop/.local/share/Trash'
  • Loading branch information
sourcejedi committed Aug 4, 2019
1 parent e966d7f commit 9750f63
Showing 1 changed file with 15 additions and 0 deletions.
15 changes: 15 additions & 0 deletions test/test.js
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,21 @@ if (!process.env.CI) {
await execa(path.join(__dirname, 'mount_clean'), [name]);
});

test('get the trash path using a dangling symlink on a mounted drive', async t => {
const name = path.join(__dirname, 'test-disk2');
const dirname = path.join(name, '.Trash-') + process.getuid();

await execa(path.join(__dirname, 'mount_create'), [name]);

const filename = path.join(name, 'dangly');
fs.symlinkSync('nonexistent', filename);

const dir = await trashdir(filename);
t.is(dirname, dir);

await execa(path.join(__dirname, 'mount_clean'), [name]);
});

test('get the trash path on a mounted drive with a top trash', async t => {
const name = path.join(__dirname, 'test-disk-top');
const dirname = path.join(name, '.Trash', String(process.getuid()));
Expand Down

0 comments on commit 9750f63

Please sign in to comment.