[v11.0.x] Angular deprecation: Prefer local "angularDetected" value to the remote one (#85632)
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',
|
signature: 'valid',
|
||||||
signatureType: 'community',
|
signatureType: 'community',
|
||||||
signatureOrg: 'Alexander Zobnin',
|
signatureOrg: 'Alexander Zobnin',
|
||||||
|
angularDetected: false,
|
||||||
} as LocalPlugin;
|
} as LocalPlugin;
|
||||||
|
|||||||
@@ -47,4 +47,5 @@ export default {
|
|||||||
links: [],
|
links: [],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
|
angularDetected: false,
|
||||||
} as RemotePlugin;
|
} as RemotePlugin;
|
||||||
|
|||||||
@@ -182,6 +182,7 @@ describe('Plugins/Helpers', () => {
|
|||||||
type: 'app',
|
type: 'app',
|
||||||
updatedAt: '2021-05-18T14:53:01.000Z',
|
updatedAt: '2021-05-18T14:53:01.000Z',
|
||||||
isFullyInstalled: false,
|
isFullyInstalled: false,
|
||||||
|
angularDetected: false,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -261,6 +262,7 @@ describe('Plugins/Helpers', () => {
|
|||||||
updatedAt: '2021-08-25',
|
updatedAt: '2021-08-25',
|
||||||
installedVersion: '4.2.2',
|
installedVersion: '4.2.2',
|
||||||
isFullyInstalled: true,
|
isFullyInstalled: true,
|
||||||
|
angularDetected: false,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -312,6 +314,7 @@ describe('Plugins/Helpers', () => {
|
|||||||
updatedAt: '2021-05-18T14:53:01.000Z',
|
updatedAt: '2021-05-18T14:53:01.000Z',
|
||||||
installedVersion: '4.2.2',
|
installedVersion: '4.2.2',
|
||||||
isFullyInstalled: true,
|
isFullyInstalled: true,
|
||||||
|
angularDetected: false,
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -694,6 +697,35 @@ describe('Plugins/Helpers', () => {
|
|||||||
// No local or remote
|
// No local or remote
|
||||||
expect(mapToCatalogPlugin()).toMatchObject({ updatedAt: '' });
|
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()', () => {
|
describe('sortPlugins()', () => {
|
||||||
|
|||||||
@@ -249,7 +249,7 @@ export function mapToCatalogPlugin(local?: LocalPlugin, remote?: RemotePlugin, e
|
|||||||
error: error?.errorCode,
|
error: error?.errorCode,
|
||||||
// Only local plugins have access control metadata
|
// Only local plugins have access control metadata
|
||||||
accessControl: local?.accessControl,
|
accessControl: local?.accessControl,
|
||||||
angularDetected: local?.angularDetected || remote?.angularDetected,
|
angularDetected: local?.angularDetected ?? remote?.angularDetected,
|
||||||
isFullyInstalled: Boolean(local) || isDisabled,
|
isFullyInstalled: Boolean(local) || isDisabled,
|
||||||
iam: local?.iam,
|
iam: local?.iam,
|
||||||
};
|
};
|
||||||
|
|||||||
Reference in New Issue
Block a user