Program: CWE-287
Project: CVE-2021-32691
Buggy source:
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Person Throws an error if trying to set an invalid gender 1`] = `"Rock gender must be either Unknown, Male, or Female"`;

exports[`Person creates a profile 1`] = `
Array [
  Array [
    "/People",
    Object {
      "BirthDay": 1,
      "BirthMonth": 2,
      "BirthYear": 2020,
      "FirstName": "Vincent",
      "Gender": 1,
      "IsSystem": false,
    },
  ],
]
`;

exports[`Person creates a profile 2`] = `Object {}`;

exports[`Person gets person from aliasId: The call to fetch the alias id 1`] = `
Array [
  Array [
    "/PersonAlias?%24filter=Id%20eq%2051&%24select=PersonId&%24top=1",
    Object {},
    Object {},
  ],
]
`;

exports[`Person gets person from aliasId: The call to fetch the person by id 1`] = `
Array [
  Array [
    123,
  ],
]
`;

exports[`Person gets person from aliasId: The result from getAliasId 1`] = `
Object {
  "firstName": "John",
  "id": 321,
}
`;

exports[`Person gets person from id 1`] = `
Array [
  Array [
    "People?%24filter=Id%20eq%2051&%24expand=Photo&%24top=1",
    Object {},
    Object {},
  ],
]
`;

exports[`Person gets person from id 2`] = `
Object {
  "id": 51,
}
`;

exports[`Person returns null when getPersonByAliasId is not valid: The call to fetch the alias id 1`] = `
Array [
  Array [
    "/PersonAlias?%24filter=Id%20eq%2051&%24select=PersonId&%24top=1",
    Object {},
    Object {},
  ],
]
`;

exports[`Person returns null when getPersonByAliasId is not valid: The result from getAliasId 1`] = `null`;

exports[`Person throws an error setting an invalid birth date 1`] = `"BirthDate must be a valid date"`;

exports[`Person updates a user's birth date attributes 1`] = `
Object {
  "birthDate": "1996-11-02T07:00:00.000Z",
  "firstName": "Vincent",
  "id": 51,
  "lastName": "Wilson",
}
`;

exports[`Person updates a user's birth date attributes 2`] = `
Array [
  Array [],
]
`;

exports[`Person updates a user's birth date attributes 3`] = `
Array [
  Array [
    "/People/51",
    Object {
      "BirthDay": 2,
      "BirthMonth": 11,
      "BirthYear": 1996,
    },
  ],
]
`;

exports[`Person updates a user's gender attributes: current person 1`] = `
Array [
  Array [],
]
`;

exports[`Person updates a user's gender attributes: result 1`] = `
Object {
  "firstName": "Vincent",
  "gender": "Male",
  "id": 51,
  "lastName": "Wilson",
}
`;

exports[`Person updates a user's gender attributes: rock patch 1`] = `Array []`;

exports[`Person updates a user's profile attributes 1`] = `
Array [
  Array [],
]
`;

exports[`Person updates a user's profile attributes 2`] = `Array []`;

exports[`Person updates a user's profile attributes 3`] = `
Object {
  "firstName": "Nick",
  "id": 51,
  "lastName": "Wilson",
}
`;

exports[`Person uploads a user's profile picture: Get media datasource mock 1`] = `
Array [
  Array [
    "456",
  ],
]
`;

exports[`Person uploads a user's profile picture: Get updated profile mock 1`] = `Array []`;

exports[`Person uploads a user's profile picture: Update profile mock 1`] = `
Array [
  Array [
    Array [
      Object {
        "field": "PhotoId",
        "value": "456",
      },
    ],
  ],
]
`;

exports[`Person uploads a user's profile picture: Upload datasource mock 1`] = `
Array [
  Array [
    Object {
      "filename": "img.jpg",
      "length": 456,
      "stream": "123",
    },
  ],
]
`;

exports[`Person uploads a user's profile picture: Upload result 1`] = `
Object {
  "firstName": "Vincent",
  "id": 51,
  "lastName": "Wilson",
  "photo": Object {
    "id": 123,
    "url": "http://imageurl.....",
  },
}
`;


Fixed version (ground truth):
// Jest Snapshot v1, https://goo.gl/fbAQLP

exports[`Person Throws an error if trying to set an invalid gender 1`] = `"Rock gender must be either Unknown, Male, or Female"`;

exports[`Person creates a profile 1`] = `
Array [
  Array [
    "/People",
    Object {
      "Gender": 0,
      "IsSystem": false,
    },
  ],
]
`;

exports[`Person gets person from aliasId: The call to fetch the alias id 1`] = `
Array [
  Array [
    "/PersonAlias?%24filter=Id%20eq%2051&%24select=PersonId&%24top=1",
    Object {},
    Object {},
  ],
]
`;

exports[`Person gets person from aliasId: The call to fetch the person by id 1`] = `
Array [
  Array [
    123,
  ],
]
`;

exports[`Person gets person from aliasId: The result from getAliasId 1`] = `
Object {
  "firstName": "John",
  "id": 321,
}
`;

exports[`Person gets person from id 1`] = `
Array [
  Array [
    "People?%24filter=Id%20eq%2051&%24expand=Photo&%24top=1",
    Object {},
    Object {},
  ],
]
`;

exports[`Person gets person from id 2`] = `
Object {
  "id": 51,
}
`;

exports[`Person returns null when getPersonByAliasId is not valid: The call to fetch the alias id 1`] = `
Array [
  Array [
    "/PersonAlias?%24filter=Id%20eq%2051&%24select=PersonId&%24top=1",
    Object {},
    Object {},
  ],
]
`;

exports[`Person returns null when getPersonByAliasId is not valid: The result from getAliasId 1`] = `null`;

exports[`Person throws an error setting an invalid birth date 1`] = `"BirthDate must be a valid date"`;

exports[`Person updates a user's birth date attributes 1`] = `
Object {
  "birthDate": "1996-11-02T07:00:00.000Z",
  "firstName": "Vincent",
  "id": 51,
  "lastName": "Wilson",
}
`;

exports[`Person updates a user's birth date attributes 2`] = `
Array [
  Array [],
]
`;

exports[`Person updates a user's birth date attributes 3`] = `
Array [
  Array [
    "/People/51",
    Object {
      "BirthDay": 2,
      "BirthMonth": 11,
      "BirthYear": 1996,
    },
  ],
]
`;

exports[`Person updates a user's gender attributes: current person 1`] = `
Array [
  Array [],
]
`;

exports[`Person updates a user's gender attributes: result 1`] = `
Object {
  "firstName": "Vincent",
  "gender": "Male",
  "id": 51,
  "lastName": "Wilson",
}
`;

exports[`Person updates a user's gender attributes: rock patch 1`] = `Array []`;

exports[`Person updates a user's profile attributes 1`] = `
Array [
  Array [],
]
`;

exports[`Person updates a user's profile attributes 2`] = `Array []`;

exports[`Person updates a user's profile attributes 3`] = `
Object {
  "firstName": "Nick",
  "id": 51,
  "lastName": "Wilson",
}
`;

exports[`Person uploads a user's profile picture: Get media datasource mock 1`] = `
Array [
  Array [
    "456",
  ],
]
`;

exports[`Person uploads a user's profile picture: Get updated profile mock 1`] = `Array []`;

exports[`Person uploads a user's profile picture: Update profile mock 1`] = `
Array [
  Array [
    Array [
      Object {
        "field": "PhotoId",
        "value": "456",
      },
    ],
  ],
]
`;

exports[`Person uploads a user's profile picture: Upload datasource mock 1`] = `
Array [
  Array [
    Object {
      "filename": "img.jpg",
      "length": 456,
      "stream": "123",
    },
  ],
]
`;

exports[`Person uploads a user's profile picture: Upload result 1`] = `
Object {
  "firstName": "Vincent",
  "id": 51,
  "lastName": "Wilson",
  "photo": Object {
    "id": 123,
    "url": "http://imageurl.....",
  },
}
`;