Add support for reactions plugin (#180)

This commit is contained in:
Simon Lecoq
2021-03-09 19:58:53 +01:00
committed by GitHub
parent a839b0ae2d
commit 732d2a44b0
11 changed files with 230 additions and 0 deletions

View File

@@ -0,0 +1,27 @@
/**Mocked data */
export default function({faker, query, login = faker.internet.userName()}) {
console.debug("metrics/compute/mocks > mocking graphql api result > reactions/default")
const type = query.match(/(?<type>issues|issueComments)[(]/)?.groups?.type ?? "(unknown type)"
return /after: "MOCKED_CURSOR"/m.test(query) ? ({
user:{
[type]:{
edges:[],
nodes:[],
},
},
}) : ({
user:{
[type]:{
edges:new Array(100).fill(null).map(_ => ({
cursor:"MOCKED_CURSOR",
node:{
createdAt:faker.date.recent(),
reactions:{
nodes:new Array(50).fill(null).map(_ => ({content:faker.random.arrayElement(["HEART", "THUMBS_UP", "THUMBS_DOWN", "LAUGH", "CONFUSED", "EYES", "ROCKET", "HOORAY"])})),
},
},
})),
},
},
})
}