chore: lint errors resolved
Signed-off-by: NIKUNJ LALITKUMAR HUDKA <nikunjhudka123@gmail.com>
This commit is contained in:
@@ -113,7 +113,7 @@ export interface EntityRefPresentation {
|
||||
/* The `promise` property in the `EntityRefPresentation` interface is defining a property named
|
||||
`promise` that holds a promise. This promise resolves to an array of
|
||||
`EntityRefPresentationSnapshot` objects. */
|
||||
promise: Promise<EntityRefPresentationSnapshot[]>;
|
||||
promise?: Promise<EntityRefPresentationSnapshot[]>;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -35,7 +35,7 @@ describe('DefaultEntityPresentationApi', () => {
|
||||
Icon: expect.anything(),
|
||||
},
|
||||
update$: undefined,
|
||||
promise: new Promise((resolve, reject) => resolve({})),
|
||||
promise: new Promise(resolve => resolve({})),
|
||||
});
|
||||
|
||||
expect(
|
||||
@@ -49,7 +49,7 @@ describe('DefaultEntityPresentationApi', () => {
|
||||
Icon: expect.anything(),
|
||||
},
|
||||
update$: undefined,
|
||||
promise: new Promise((resolve, reject) => resolve({})),
|
||||
promise: new Promise(resolve => resolve({})),
|
||||
});
|
||||
|
||||
expect(
|
||||
@@ -65,7 +65,7 @@ describe('DefaultEntityPresentationApi', () => {
|
||||
Icon: expect.anything(),
|
||||
},
|
||||
update$: undefined,
|
||||
promise: new Promise((resolve, reject) => resolve({})),
|
||||
promise: new Promise(resolve => resolve({})),
|
||||
});
|
||||
|
||||
const entity: Entity = {
|
||||
@@ -88,7 +88,7 @@ describe('DefaultEntityPresentationApi', () => {
|
||||
Icon: expect.anything(),
|
||||
},
|
||||
update$: undefined,
|
||||
promise: new Promise((resolve, reject) => resolve({})),
|
||||
promise: new Promise(resolve => resolve({})),
|
||||
});
|
||||
});
|
||||
|
||||
@@ -192,8 +192,8 @@ describe('DefaultEntityPresentationApi', () => {
|
||||
|
||||
const snapshots = await promise;
|
||||
|
||||
expect(snapshots.length).toEqual(1); // Only one snapshot expected
|
||||
expect(snapshots[0]).toEqual(entitySnapshot); // Snapshot should match the simulated one
|
||||
expect(snapshots?.length).toEqual(1); // Only one snapshot expected
|
||||
expect(snapshots?.[0]).toEqual(entitySnapshot); // Snapshot should match the simulated one
|
||||
});
|
||||
});
|
||||
|
||||
|
||||
@@ -302,30 +302,28 @@ export class DefaultEntityPresentationApi implements EntityPresentationApi {
|
||||
snapshot: initialSnapshot,
|
||||
update$: observable,
|
||||
get promise() {
|
||||
return new Promise<EntityRefPresentationSnapshot[]>(
|
||||
(resolve, reject) => {
|
||||
if (!observable) {
|
||||
resolve([initialSnapshot]);
|
||||
} else {
|
||||
const res: EntityRefPresentationSnapshot[] = [];
|
||||
const subscription = observable.subscribe({
|
||||
next: snapshot => {
|
||||
res.push(snapshot);
|
||||
},
|
||||
error: error => {
|
||||
initialSnapshot = {
|
||||
primaryTitle: entityRef,
|
||||
entityRef: entityRef,
|
||||
};
|
||||
},
|
||||
complete() {
|
||||
subscription.unsubscribe();
|
||||
resolve(res);
|
||||
},
|
||||
});
|
||||
}
|
||||
},
|
||||
);
|
||||
return new Promise<EntityRefPresentationSnapshot[]>(resolve => {
|
||||
if (!observable) {
|
||||
resolve([initialSnapshot]);
|
||||
} else {
|
||||
const res: EntityRefPresentationSnapshot[] = [];
|
||||
const subscription = observable.subscribe({
|
||||
next: snapshot => {
|
||||
res.push(snapshot);
|
||||
},
|
||||
error: () => {
|
||||
initialSnapshot = {
|
||||
primaryTitle: entityRef,
|
||||
entityRef: entityRef,
|
||||
};
|
||||
},
|
||||
complete() {
|
||||
subscription.unsubscribe();
|
||||
resolve(res);
|
||||
},
|
||||
});
|
||||
}
|
||||
});
|
||||
},
|
||||
};
|
||||
return entityRefPresentation;
|
||||
|
||||
Reference in New Issue
Block a user