-
Notifications
You must be signed in to change notification settings - Fork 30
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat: remove all netrc entries on logout
- Loading branch information
1 parent
72d788f
commit 1860665
Showing
5 changed files
with
32 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
import { addNetrcEntry, getNetrcCredentials, getNetrcFilePath, isAuthorized, removeNetrcEntry } from './creds' | ||
import { addNetrcEntry, getNetrcCredentials, getNetrcFilePath, isAuthorized, removeAllNetrcEntries, removeNetrcEntry } from './creds' | ||
import { vol } from 'memfs' | ||
import { join } from 'pathe' | ||
// tell vitest to use fs mock from __mocks__ folder | ||
|
@@ -180,6 +180,22 @@ describe('creds', async () => { | |
}) | ||
}) | ||
|
||
describe('removeAllNetrcEntries', () => { | ||
it('should remove all entries from .netrc file', async () => { | ||
vol.fromJSON({ | ||
'test/.netrc': `machine api.storyblok.com | ||
login [email protected] | ||
password my_access_token | ||
region eu`, | ||
}, '/temp') | ||
|
||
await removeAllNetrcEntries('/temp/test/.netrc') | ||
|
||
const content = vol.readFileSync('/temp/test/.netrc', 'utf8') | ||
|
||
expect(content).toBe('') | ||
}) | ||
}) | ||
describe('isAuthorized', () => { | ||
beforeEach(() => { | ||
vol.reset() | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters