Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

mockNode is returning type of Node rather than Node<Interger, Properties, String> and pulling from global.node. #22

Open
codeninja opened this issue Nov 12, 2024 · 0 comments

Comments

@codeninja
Copy link

codeninja commented Nov 12, 2024

In my code I'm expecting Node from neo4j-driver which is returned by the actual method. However your mockNode method (handy by the way thank you) id returning Node from global.node.

image

    it('should create a relationship', async () => {
      const mockNode1 = mockNode('Person', { name: 'Linda' });
      const mockNode2 = mockNode('Person', { name: 'Frank' });
      const mockRel = { type: 'KNOWS', properties: {} };

      jest
        .spyOn(neo4jService, 'write')
        .mockResolvedValueOnce(mockResult([{ node: mockNode1 }]))
        .mockResolvedValueOnce(mockResult([{ node: mockNode2 }]))
        .mockResolvedValueOnce(mockResult([{ relationship: mockRel }]));

      const relationship = await service.createRelationship(mockNode1, mockNode2, 'KNOWS');
      expect(relationship).toBeDefined();
      expect(relationship.type).toEqual('KNOWS');
    });

image

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant