Skip to content

createHydratedMock and cloneDeep from LoDash are not loving each other #751

Open
@C0ZEN

Description

@C0ZEN

Subject of the issue

After migrating from createMock to createHydratedMock, I had a failing test.
I added some debuggers and I found out that nothing happened after using a cloneDeep.
Removing the cloneDeep allow the test to pass as expected.
Using a spread operator is working as expected as well.
It means that there is something specific made inside the cloneDeep that createHydratedMock can't handle.

Your environment

  • ts-auto-mock version: 3.2.2
  • typescript version: 4.2.4
  • node version: 14.16.0
  • npm version: 7.12.1
  • lodash: 4.17.21

Steps to reproduce

This is the object that should be copied (as JSON):

{
  "response": "dummy-response",
  "options": {
    "tts": false,
    "nonce": "",
    "disableMentions": "none",
    "files": [],
    "code": "",
    "split": false,
    "content": "",
    "embed": {},
    "allowedMentions": {
      "parse": [],
      "roles": [],
      "users": []
    },
    "reply": {}
  }
}

image

Expected behavior

The test pass and the cloneDeep works as expected when using createHydratedMock.

Actual behavior

The test fail due to the cloneDeep.

Original issue

Sonia-corporation/sonia-discord#1383

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions