ensure id field provided for mock conversation participant
flag=none test plan: - specs pass qa risk: low Change-Id: I6a8296bec1a4c32d84ae4c3ee7fcd566c6915ca8 Reviewed-on: https://gerrit.instructure.com/c/canvas-lms/+/274141 Tested-by: Service Cloud Jenkins <svc.cloudjenkins@instructure.com> Reviewed-by: Omar Soto-Fortuño <omar.soto@instructure.com> QA-Review: Omar Soto-Fortuño <omar.soto@instructure.com> Product-Review: Omar Soto-Fortuño <omar.soto@instructure.com>
This commit is contained in:
parent
044aede0c8
commit
6b0271a7a5
|
@ -182,7 +182,6 @@ const ignoredWarnings = [
|
|||
/is deprecated and will be removed/,
|
||||
/Missing field __typename in/,
|
||||
/Missing field errors in/,
|
||||
/Missing field id in/,
|
||||
/Missing field moduleItem in/,
|
||||
/Please update the following components: %s/,
|
||||
/shared_brand_configs.* not called/,
|
||||
|
|
|
@ -25,6 +25,18 @@ import {graphql} from 'msw'
|
|||
import {Group} from './Group'
|
||||
import {User} from './User'
|
||||
|
||||
// helper function that filters out undefined values in objects before assigning
|
||||
const mswAssign = (target, ...objects) => {
|
||||
return Object.assign(
|
||||
target,
|
||||
...objects.map(object => {
|
||||
return Object.entries(object)
|
||||
.filter(([_k, v]) => v !== undefined)
|
||||
.reduce((obj, [k, v]) => ((obj[k] = v), obj), {}) // eslint-disable-line no-sequences
|
||||
})
|
||||
)
|
||||
}
|
||||
|
||||
export const handlers = [
|
||||
graphql.query('GetConversationsQuery', (req, res, ctx) => {
|
||||
const data = {
|
||||
|
@ -247,11 +259,13 @@ export const handlers = [
|
|||
ctx.data({
|
||||
updateConversationParticipants: {
|
||||
conversationParticipants: [
|
||||
{
|
||||
...ConversationParticipant.mock(),
|
||||
id: req.body.variables.conversationId,
|
||||
read: req.body.variables.read
|
||||
}
|
||||
mswAssign(
|
||||
{...ConversationParticipant.mock()},
|
||||
{
|
||||
id: req.body.variables.conversationId,
|
||||
read: req.body.variables.read
|
||||
}
|
||||
)
|
||||
],
|
||||
errors: null,
|
||||
__typename: 'UpdateConversationParticipantsPayload'
|
||||
|
|
Loading…
Reference in New Issue