[v10.4.x] Angular deprecation: Prefer local "angularDetected" value to the remote one (#85631)
Angular deprecation: Prefer local "angularDetected" value to the remote one (#85571)
* Angular deprecation: Prefer local value to remote
* Update tests
(cherry picked from commit c033a15aaa)
This commit is contained in:
@@ -68,4 +68,5 @@ export default {
|
||||
signature: 'valid',
|
||||
signatureType: 'community',
|
||||
signatureOrg: 'Alexander Zobnin',
|
||||
angularDetected: false,
|
||||
} as LocalPlugin;
|
||||
|
||||
@@ -47,4 +47,5 @@ export default {
|
||||
links: [],
|
||||
},
|
||||
},
|
||||
angularDetected: false,
|
||||
} as RemotePlugin;
|
||||
|
||||
@@ -158,6 +158,7 @@ describe('Plugins/Helpers', () => {
|
||||
type: 'app',
|
||||
updatedAt: '2021-05-18T14:53:01.000Z',
|
||||
isFullyInstalled: false,
|
||||
angularDetected: false,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -237,6 +238,7 @@ describe('Plugins/Helpers', () => {
|
||||
updatedAt: '2021-08-25',
|
||||
installedVersion: '4.2.2',
|
||||
isFullyInstalled: true,
|
||||
angularDetected: false,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -288,6 +290,7 @@ describe('Plugins/Helpers', () => {
|
||||
updatedAt: '2021-05-18T14:53:01.000Z',
|
||||
installedVersion: '4.2.2',
|
||||
isFullyInstalled: true,
|
||||
angularDetected: false,
|
||||
});
|
||||
});
|
||||
|
||||
@@ -670,6 +673,35 @@ describe('Plugins/Helpers', () => {
|
||||
// No local or remote
|
||||
expect(mapToCatalogPlugin()).toMatchObject({ updatedAt: '' });
|
||||
});
|
||||
|
||||
test('`.angularDetected` - prefers the local', () => {
|
||||
// Both false shoul return false
|
||||
expect(
|
||||
mapToCatalogPlugin({ ...localPlugin, angularDetected: false }, { ...remotePlugin, angularDetected: false })
|
||||
).toMatchObject({ angularDetected: false });
|
||||
|
||||
// Remote version is using angular, local isn't, should prefer local
|
||||
expect(
|
||||
mapToCatalogPlugin({ ...localPlugin, angularDetected: false }, { ...remotePlugin, angularDetected: true })
|
||||
).toMatchObject({ angularDetected: false });
|
||||
|
||||
// Remote only
|
||||
expect(mapToCatalogPlugin(undefined, remotePlugin)).toMatchObject({ angularDetected: false });
|
||||
expect(mapToCatalogPlugin(undefined, { ...remotePlugin, angularDetected: true })).toMatchObject({
|
||||
angularDetected: true,
|
||||
});
|
||||
|
||||
// Local only
|
||||
expect(mapToCatalogPlugin({ ...localPlugin, angularDetected: false }, undefined)).toMatchObject({
|
||||
angularDetected: false,
|
||||
});
|
||||
expect(mapToCatalogPlugin({ ...localPlugin, angularDetected: true }, undefined)).toMatchObject({
|
||||
angularDetected: true,
|
||||
});
|
||||
|
||||
// No local or remote
|
||||
expect(mapToCatalogPlugin()).toMatchObject({ angularDetected: undefined });
|
||||
});
|
||||
});
|
||||
|
||||
describe('sortPlugins()', () => {
|
||||
|
||||
@@ -225,7 +225,7 @@ export function mapToCatalogPlugin(local?: LocalPlugin, remote?: RemotePlugin, e
|
||||
error: error?.errorCode,
|
||||
// Only local plugins have access control metadata
|
||||
accessControl: local?.accessControl,
|
||||
angularDetected: local?.angularDetected || remote?.angularDetected,
|
||||
angularDetected: local?.angularDetected ?? remote?.angularDetected,
|
||||
isFullyInstalled: Boolean(local) || isDisabled,
|
||||
iam: local?.iam,
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user