Bug: Expect a plugin signature per version (#74595)

This commit is contained in:
Andres Martinez Gotor 2023-09-12 09:31:38 +02:00 committed by GitHub
parent 36728dd671
commit 29238c19fd
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 7 deletions

View File

@ -113,14 +113,29 @@ describe('Plugins/Helpers', () => {
test('adds the correct signature enum', () => {
const pluginWithoutSignature = { ...remotePlugin, signatureType: '', versionSignatureType: '' } as RemotePlugin;
// With only "signatureType" -> valid
const pluginWithSignature1 = { ...remotePlugin, signatureType: PluginSignatureType.commercial } as RemotePlugin;
// With only "versionSignatureType" -> valid
const pluginWithSignature2 = { ...remotePlugin, versionSignatureType: PluginSignatureType.core } as RemotePlugin;
// With only "signatureType" -> invalid
const pluginWithSignature1 = {
...remotePlugin,
signatureType: PluginSignatureType.commercial,
versionSignatureType: '',
} as RemotePlugin;
// With only "versionSignatureType" -> invalid
const pluginWithSignature2 = {
...remotePlugin,
signatureType: '',
versionSignatureType: PluginSignatureType.core,
} as RemotePlugin;
// With signatureType and versionSignatureType -> valid
const pluginWithSignature3 = {
...remotePlugin,
signatureType: PluginSignatureType.commercial,
versionSignatureType: PluginSignatureType.commercial,
} as RemotePlugin;
expect(mapRemoteToCatalog(pluginWithoutSignature).signature).toBe(PluginSignatureStatus.missing);
expect(mapRemoteToCatalog(pluginWithSignature1).signature).toBe(PluginSignatureStatus.valid);
expect(mapRemoteToCatalog(pluginWithSignature2).signature).toBe(PluginSignatureStatus.valid);
expect(mapRemoteToCatalog(pluginWithSignature1).signature).toBe(PluginSignatureStatus.missing);
expect(mapRemoteToCatalog(pluginWithSignature2).signature).toBe(PluginSignatureStatus.missing);
expect(mapRemoteToCatalog(pluginWithSignature3).signature).toBe(PluginSignatureStatus.valid);
});
test('adds an "isEnterprise" field', () => {

View File

@ -250,7 +250,7 @@ function getPluginSignature(options: {
return local.signature;
}
if (remote?.signatureType || remote?.versionSignatureType) {
if (remote?.signatureType && remote?.versionSignatureType) {
return PluginSignatureStatus.valid;
}