tests: move mocks to tests/*
This commit is contained in:
34
tests/mocks/api/github/graphql/notable.contributions.mjs
Normal file
34
tests/mocks/api/github/graphql/notable.contributions.mjs
Normal file
@@ -0,0 +1,34 @@
|
||||
/**Mocked data */
|
||||
export default function({faker, query, login = faker.internet.userName()}) {
|
||||
console.debug("metrics/compute/mocks > mocking graphql api result > notable/contributions")
|
||||
return /after: "MOCKED_CURSOR"/m.test(query)
|
||||
? ({
|
||||
user:{
|
||||
repositoriesContributedTo:{
|
||||
edges:[],
|
||||
},
|
||||
},
|
||||
})
|
||||
: ({
|
||||
user:{
|
||||
repositoriesContributedTo:{
|
||||
edges:[
|
||||
{
|
||||
cursor:"MOCKED_CURSOR",
|
||||
node:{
|
||||
isInOrganization:true,
|
||||
owner:{
|
||||
login:faker.internet.userName(),
|
||||
avatarUrl:null,
|
||||
},
|
||||
nameWithOwner:`${faker.internet.userName()}/${faker.lorem.slug()}`,
|
||||
stargazers:{totalCount:faker.datatype.number(1000)},
|
||||
watchers:{totalCount:faker.datatype.number(1000)},
|
||||
forks:{totalCount:faker.datatype.number(1000)},
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
},
|
||||
})
|
||||
}
|
||||
Reference in New Issue
Block a user