Hello, I'm new to Prisma and have been trying to m...
# orm-help
s
Hello, I'm new to Prisma and have been trying to mock the Prisma client according to this guide: https://www.prisma.io/docs/guides/testing/unit-testing. I follow the singleton pattern and have a unit test for mocking the process of creating new data:
Copy code
import { prismaMock } from './../singleton';
import { XyzLayerModel } from './../src/api/crud/xyz-layer/xyz-layer.model';

test('Create new xyz-layer', async () => {
  const model = new XyzLayerModel()
  const newXyz = {
    id: 1,
    name: 'string',
    description: 'string'
  }

  prismaMock.xyzLayer.create.mockResolvedValue(newXyz);
  
  await expect(model.create(newXyz)).resolves.toEqual({
    id: 1,
    name: 'string',
    description: 'string'
  });
});
The following line is highlighted as an error by VSCode:
prismaMock.xyzLayer.create.mockResolvedValue(newXyz);
The error message says: Type of property 'AND' circularly references itself in mapped type '{ [K in keyof { AND?: Enumerable<XyzLayerScalarWhereWithAggregatesInput>; OR?: Enumerable<XyzLayerScalarWhereWithAggregatesInput>; ... 11 more ...; updatedAt?: string | ... 1 more ... | DateTimeWithAggregatesFilter; }]: Or<...> extends 1 ? { ...; }[K] extends infer TK ? GetHavingFields<...> : never : {} extends Fiel...'.ts(2615) The same applies to property 'NOT' and 'OR'. Does someone know a solution for this problem? Thank you in advance.