Ad
  • Custom User Avatar

    The random tests reject my solution despite the output being identical to the expected one, the only difference being the ordering of items in the objects and the arrays. Am I missing something? Has anyone encountered a similar issue?

  • Custom User Avatar
  • Custom User Avatar
  • Custom User Avatar

    Approved at 6kyu (average assessed rank).

  • Custom User Avatar

    Added clarifications and changed the structure of the authorPosts state to be simpler.

    The authors state consists of all the authors, posts and comments.

    The order of the elements are based on the ordering of the allIds arrays. The ordering for them is in order of appearance.
    If you mean ordering in the byId objects, this doesn't obviously matter since they are look-up tables.

    The authorPosts state is now just simply and array of postIds for a user.

    I updated the description to address all of these points.

  • Custom User Avatar
  • Custom User Avatar

    what is the expected order of elements in the state?

    You mean allIds.

  • Custom User Avatar

    Random tests keep generating datasets where authors with the same username have different names in the same dataset:

    [
      {
        id: 'post1',
        author: { username: 'user6', name: 'User 1' },
        body: 'bPJRA4WrVCglam6qqsfd',
        comments: [
          {
            id: 'comment1-1',
            author: { username: 'user3', name: 'User 1-1' },
            comment: 'FBFWegeJROBZhBb39RTFPvQJBHYdvrj2'
          }
        ]
      },
      {
        id: 'post2',
        author: { username: 'user8', name: 'User 2' },
        body: 'dhfwPPGsXHXrsgny7Vdejre34Q610ob41',
        comments: []
      },
      {
        id: 'post3',
        author: { username: 'user1', name: 'User 3' },
        body: '8pLYNPfutgKoWYQVJ5AWTyZ4TBnC7wRj1GZn8n1n',
        comments: [
          {
            id: 'comment3-1',
            author: { username: 'user6', name: 'User 3-1' },
            comment: 'mIlSFpThna44yO'
          },
          {
            id: 'comment3-2',
            author: { username: 'user1', name: 'User 3-2' },
            comment: 'vJ72EyPUBADcWNCX23ugeLLv'
          },
          {
            id: 'comment3-3',
            author: { username: 'user2', name: 'User 3-3' },
            comment: 'w5DDc8IY9XWOGdmmtBCSaTyJ9ti8WA91402kG0QftulY'
          },
          {
            id: 'comment3-4',
            author: { username: 'user8', name: 'User 3-4' },
            comment: 'HD7wHb3UXUI3UKAErm3d98S'
          },
          {
            id: 'comment3-5',
            author: { username: 'user7', name: 'User 3-5' },
            comment: 'Z3irR6mQuV33'
          }
        ]
      },
      {
        id: 'post4',
        author: { username: 'user1', name: 'User 4' },
        body: 'TDvNq1VKHjDNTxvXCCERwkdHsvMP',
        comments: [
          {
            id: 'comment4-1',
            author: { username: 'user2', name: 'User 4-1' },
            comment: 'MYCnb6CVlgW5DP7M6IVAKBo'
          },
          {
            id: 'comment4-2',
            author: { username: 'user3', name: 'User 4-2' },
            comment: 'g1tyBszv36mNSIXFzQ05JIcyUU3ySoAgbexz3VJ3rN'
          }
        ]
      },
      {
        id: 'post5',
        author: { username: 'user4', name: 'User 5' },
        body: 'uT1r6X286Xpm3DNgIeKj0LfPoAEwgLncoi',
        comments: [
          {
            id: 'comment5-1',
            author: { username: 'user8', name: 'User 5-1' },
            comment: 'xEG5pRNP7wQT4vWbnCUCwFr7'
          },
          {
            id: 'comment5-2',
            author: { username: 'user4', name: 'User 5-2' },
            comment: '2ra7lQdTJ8CPDJma'
          },
          {
            id: 'comment5-3',
            author: { username: 'user6', name: 'User 5-3' },
            comment: '2T6zReL4wEf0XWNZ2U57Bqa4TpClmO7jVAFD7OBoGjNYmqc4'
          },
          {
            id: 'comment5-4',
            author: { username: 'user7', name: 'User 5-4' },
            comment: '2fHTm6z35CvjCyhngnrt3t6PCct7IuL9'
          }
        ]
      },
      {
        id: 'post6',
        author: { username: 'user3', name: 'User 6' },
        body: 'q7sksxpI2MBOH8xhQgaasLuWY',
        comments: [
          {
            id: 'comment6-1',
            author: { username: 'user9', name: 'User 6-1' },
            comment: 'K5jybddXG4uJ'
          },
          {
            id: 'comment6-2',
            author: { username: 'user4', name: 'User 6-2' },
            comment: 'Y3GjE7cSXiXEN6'
          },
          {
            id: 'comment6-3',
            author: { username: 'user10', name: 'User 6-3' },
            comment: 'O6CnaCtA4VAqFMKLy5uK4zxwy2GHjFq9lt3qK0nL'
          },
          {
            id: 'comment6-4',
            author: { username: 'user1', name: 'User 6-4' },
            comment: 'juNtFAUidcgOefbRc164O'
          }
        ]
      }
    ]
    

    user6 has 3 different names in the same object.

  • Custom User Avatar

    Some things are not clear from description:

    • are only post authors to be considered or also comment authors for the resulting "authors" state?
    • what is the expected order of elements in the state?
    • what is the purpose of the id field in the authorPost state, as it's always the same as postId?
  • Custom User Avatar

    Thank you for the feedback! Issue is fixed now.

  • Custom User Avatar

    I wrote that line at roughly 3AM so it's kinda unclear; it means "distinguish between null/undefined and missing properties when merging".

  • Custom User Avatar

    This can be fixed by adding chai.config.truncateThreshold = 0

  • Custom User Avatar

    The solution should distinguish between null, undefined, and missing values

    Distinguish how? This really needs to be explained in more detail.

  • Custom User Avatar
    expected [ { id: 1, a: undefined }, …(5) ] to deeply equal [ { id: 1, a: undefined }, …(5) ]
    

    There needs to be better feedback. You can't really debug this.

  • Custom User Avatar

    Oh snaps, this time I'm late for good :(

  • Loading more items...