Skip to content

Commit

Permalink
Merge pull request #7512 from mook-as/manageLinesInFile/preserve-xattr
Browse files Browse the repository at this point in the history
Path management: Fix xattr tests
  • Loading branch information
jandubois authored Sep 19, 2024
2 parents 8e6f537 + f5092a6 commit 507747a
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ describe('manageLinesInFile', () => {
});

describe('Target exists as a plain file', () => {
testUnix('Fails if file has extended attributes', async() => {
testUnix('Preserves extended attributes', async() => {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment -- This only fails on Windows
// @ts-ignore // fs-xattr is not available on Windows.
const { get, list, set } = await import('fs-xattr');
Expand All @@ -74,7 +74,7 @@ describe('manageLinesInFile', () => {

await fs.promises.writeFile(rcFilePath, unmanagedContents);
await set(rcFilePath, attributeKey, attributeValue);
expect(manageLinesInFile(rcFilePath, [TEST_LINE_1], true)).rejects.toThrow();
await expect(manageLinesInFile(rcFilePath, [TEST_LINE_1], true)).resolves.not.toThrow();
await expect(list(rcFilePath)).resolves.toEqual([attributeKey]);
await expect(get(rcFilePath, attributeKey)).resolves.toEqual(Buffer.from(attributeValue, 'utf-8'));
});
Expand Down

0 comments on commit 507747a

Please sign in to comment.