mirror of
https://github.com/s4u/maven-settings-action.git
synced 2026-02-12 00:05:49 +08:00
Resolves s4u/maven-settings-action#348, plugin repositories support
This commit is contained in:
committed by
Slawomir Jaranowski
parent
06520eb502
commit
074e0bfd5e
@ -87,7 +87,7 @@ afterAll(() => {
|
||||
}
|
||||
|
||||
try {
|
||||
fs.rmdirSync(testHomePath);
|
||||
fs.rmSync(testHomePath, { recursive: true });
|
||||
} catch (error) {
|
||||
}
|
||||
});
|
||||
@ -841,17 +841,60 @@ test('addCustomRepositories - one with snapshots one without', () => {
|
||||
<id>repoId</id>
|
||||
<name>repoName</name>
|
||||
<url>url</url>
|
||||
|
||||
<snapshots><enabled>true</enabled></snapshots>
|
||||
</repository> <repository>
|
||||
<id>repoId2</id>
|
||||
|
||||
<url>url2</url>
|
||||
|
||||
|
||||
</repository></repositories>
|
||||
<pluginRepositories/>
|
||||
</profile></profiles>`);
|
||||
});
|
||||
|
||||
test('addCustomPluginRepositories - one with releases and snapshots one without', () => {
|
||||
|
||||
process.env['INPUT_PLUGINREPOSITORIES'] = `
|
||||
[{"id":"repoId",
|
||||
"name":"repoName",
|
||||
"url":"url",
|
||||
"releases":{"enabled":false},
|
||||
"snapshots":{"enabled":true}
|
||||
},{
|
||||
"id":"repoId2",
|
||||
"url":"url2"
|
||||
}]`
|
||||
|
||||
const xml = stringAsXml('<profiles/>');
|
||||
|
||||
settings.fillRepositories(xml,'pluginRepositories');
|
||||
|
||||
const xmlStr = new XMLSerializer().serializeToString(xml);
|
||||
expect(xmlStr).toBe(`<profiles>
|
||||
<profile>
|
||||
<id>_custom_repositories_</id>
|
||||
<activation>
|
||||
<activeByDefault>true</activeByDefault>
|
||||
</activation>
|
||||
<repositories/>
|
||||
<pluginRepositories> <pluginRepository>
|
||||
<id>repoId</id>
|
||||
<name>repoName</name>
|
||||
<url>url</url>
|
||||
<releases><enabled>false</enabled></releases>
|
||||
<snapshots><enabled>true</enabled></snapshots>
|
||||
</pluginRepository> <pluginRepository>
|
||||
<id>repoId2</id>
|
||||
|
||||
<url>url2</url>
|
||||
|
||||
|
||||
</pluginRepository></pluginRepositories>
|
||||
</profile></profiles>`);
|
||||
});
|
||||
|
||||
test('addCustomRepositories - fail if url is missing', () => {
|
||||
|
||||
process.env['INPUT_REPOSITORIES'] = '[{"id":"repoId","name":"repoName"}]'
|
||||
@ -876,4 +919,4 @@ test('addCustomRepositories - fail if url is missing', () => {
|
||||
expect.stringMatching(/::error::repositories must contain id and url/)
|
||||
])
|
||||
);
|
||||
});
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user