Skip to content

core/merge function does not handle certain cases #13031

Closed
@magom001

Description

@magom001

Environment

Paste here

Reproduction URL

n/a

Describe the issue

Given the target

const target = {
      sessionToken: {
        name: "authjs.session-token",
        options: {
          httpOnly: true,
          sameSite: "lax",
          path: "/",
          secure: false,
        },
      }
    }

And the source

const source = {
      sessionToken: {
        options: {
          expires: new Date("2024-01-01T00:00:00Z"),
        },
      }
    }

I expect to get:

    const expected = {
      sessionToken: {
        name: "authjs.session-token",
        options: {
          httpOnly: true,
          sameSite: "lax",
          path: "/",
          secure: false,
          expires: source.sessionToken.options.expires,
        },
      }
    }

Actual result:

 Object {
    "sessionToken": Object {
      "name": "authjs.session-token",
      "options": Object {
-       "expires": 2024-01-01T00:00:00.000Z,
+       "expires": Object {},
        "httpOnly": true,
        "path": "/",
        "sameSite": "lax",
        "secure": false,
      },
    },
  }

How to reproduce

I have a PR: #13030

Added a unit test for the case descibed in the issue. The original implementation failed as described.

Expected behavior

See the description

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't workinginvalid reproductionThe issue did not have a detectable valid reproduction URLtriageUnseen or unconfirmed by a maintainer yet. Provide extra information in the meantime.

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions