chore: handle properly extensions with case

fixes https://github.com/containers/podman-desktop/issues/6961
Signed-off-by: Florent Benoit <fbenoit@redhat.com>
This commit is contained in:
Florent Benoit 2024-04-25 16:27:02 +02:00 committed by Florent BENOIT
parent 5eeecd8f3f
commit 1a71bade70
4 changed files with 7 additions and 5 deletions

View file

@ -33,7 +33,7 @@ beforeEach(() => {
test('Expect to delete dd Extension', async () => {
const extension: CombinedExtensionInfoUI = {
type: 'dd',
id: '',
id: 'my.ExtensionId',
name: 'foo',
description: 'my description',
displayName: '',
@ -54,7 +54,7 @@ test('Expect to delete dd Extension', async () => {
await fireEvent.click(button);
// expect the delete function to be called
expect(vi.mocked(window.ddExtensionDelete)).toHaveBeenCalledWith('foo');
expect(vi.mocked(window.ddExtensionDelete)).toHaveBeenCalledWith('my.ExtensionId');
expect(vi.mocked(window.removeExtension)).not.toHaveBeenCalled();
});

View file

@ -12,7 +12,7 @@ let inProgress = false;
async function deleteExtension(): Promise<void> {
inProgress = true;
if (extension.type === 'dd') {
await window.ddExtensionDelete(extension.name);
await window.ddExtensionDelete(extension.id);
} else {
await window.removeExtension(extension.id);
}

View file

@ -37,7 +37,7 @@ test('combined extensions from DD', async () => {
// now, add some contributions
contributions.set([
{
id: 'first.extension1',
id: 'extension1',
extensionId: 'first.extension1',
description: 'test1',
type: 'hello',
@ -51,7 +51,7 @@ test('combined extensions from DD', async () => {
version: '1.0.0',
},
{
id: 'second.extension2',
id: 'extension2',
extensionId: 'second.extension2',
description: 'test2',
type: 'hello',
@ -75,6 +75,7 @@ test('combined extensions from DD', async () => {
expect(extension1?.type).toBe('dd');
expect(extension1?.displayName).toBe('test1');
expect(extension1?.id).toBe('first.extension1');
});
test('combined extensions from PD', async () => {

View file

@ -44,6 +44,7 @@ export const combinedInstalledExtensions: Readable<CombinedExtensionInfoUI[]> =
}
return {
...ext,
id: ext.extensionId,
displayName,
type: 'dd',
state: 'started',