|
|
@@ -732,7 +732,7 @@ describe('reset', () => {
|
|
|
|
|
|
const initialEntity = new DummyApiModel()
|
|
|
initialEntity.id = 1
|
|
|
- initialEntity.name = 'serges'
|
|
|
+ initialEntity.name = 'serge'
|
|
|
|
|
|
// @ts-ignore
|
|
|
entityManager.getInitialStateOf = vi.fn(
|
|
|
@@ -750,7 +750,7 @@ describe('reset', () => {
|
|
|
// @ts-ignore
|
|
|
repo.save = vi.fn((data: any) => null)
|
|
|
|
|
|
- const result = entityManager.reset(DummyApiModel, entity)
|
|
|
+ const result = entityManager.reset(initialEntity)
|
|
|
|
|
|
// @ts-ignore
|
|
|
expect(entityManager.getInitialStateOf).toHaveBeenCalledWith(
|
|
|
@@ -769,8 +769,12 @@ describe('reset', () => {
|
|
|
entityManager.getInitialStateOf = vi.fn(
|
|
|
(model: typeof ApiResource, id: string | number) => null,
|
|
|
)
|
|
|
+ // @ts-ignore
|
|
|
+ entityManager.getModel = vi.fn(
|
|
|
+ (instance: ApiResource) => DummyApiModel,
|
|
|
+ )
|
|
|
|
|
|
- expect(() => entityManager.reset(DummyApiModel, entity)).toThrowError(
|
|
|
+ expect(() => entityManager.reset(entity)).toThrowError(
|
|
|
'no initial state recorded for this object - abort [dummyModel/1]',
|
|
|
)
|
|
|
})
|