mirror of
https://github.com/actions/setup-java.git
synced 2024-08-16 10:19:51 +02:00
Add test for overwrite
This commit is contained in:
parent
b7e70417f9
commit
6ae690c576
1 changed files with 20 additions and 1 deletions
|
@ -42,7 +42,26 @@ describe('auth tests', () => {
|
||||||
);
|
);
|
||||||
}, 100000);
|
}, 100000);
|
||||||
|
|
||||||
it('does not create settings.xml without username and / or password', async () => {
|
it('overwrites existing settings.xml files', async () => {
|
||||||
|
const id = 'packages';
|
||||||
|
const username = 'bluebottle';
|
||||||
|
const password = 'SingleOrigin';
|
||||||
|
|
||||||
|
fs.mkdirSync(m2Dir, {recursive: true});
|
||||||
|
fs.writeFileSync(settingsFile, "FAKE FILE");
|
||||||
|
expect(fs.existsSync(m2Dir)).toBe(true);
|
||||||
|
expect(fs.existsSync(settingsFile)).toBe(true);
|
||||||
|
|
||||||
|
await auth.configAuthentication(id, username, password);
|
||||||
|
|
||||||
|
expect(fs.existsSync(m2Dir)).toBe(true);
|
||||||
|
expect(fs.existsSync(settingsFile)).toBe(true);
|
||||||
|
expect(fs.readFileSync(settingsFile, 'utf-8')).toEqual(
|
||||||
|
auth.generate(id, username, password)
|
||||||
|
);
|
||||||
|
}, 100000);
|
||||||
|
|
||||||
|
it('does not create settings.xml without required parameters', async () => {
|
||||||
await auth.configAuthentication('FOO', '', '');
|
await auth.configAuthentication('FOO', '', '');
|
||||||
|
|
||||||
expect(fs.existsSync(m2Dir)).toBe(false);
|
expect(fs.existsSync(m2Dir)).toBe(false);
|
||||||
|
|
Loading…
Reference in a new issue