chore: code formatting
This commit is contained in:
@@ -1,5 +1,5 @@
|
||||
/**Mocked data */
|
||||
export default function({faker, url, options, login = faker.internet.userName()}) {
|
||||
export default function({ faker, url, options, login = faker.internet.userName() }) {
|
||||
//Spotify api
|
||||
if (/^https:..api.spotify.com.*$/.test(url)) {
|
||||
//Get recently played tracks
|
||||
@@ -8,140 +8,140 @@ export default function({faker, url, options, login = faker.internet.userName()}
|
||||
const artist = faker.random.words()
|
||||
const track = faker.random.words(5)
|
||||
return ({
|
||||
status:200,
|
||||
data:{
|
||||
items:[
|
||||
status: 200,
|
||||
data: {
|
||||
items: [
|
||||
{
|
||||
track:{
|
||||
album:{
|
||||
album_type:"single",
|
||||
artists:[
|
||||
track: {
|
||||
album: {
|
||||
album_type: "single",
|
||||
artists: [
|
||||
{
|
||||
name:artist,
|
||||
type:"artist",
|
||||
name: artist,
|
||||
type: "artist",
|
||||
},
|
||||
],
|
||||
images:[
|
||||
images: [
|
||||
{
|
||||
height:640,
|
||||
url:faker.image.abstract(),
|
||||
width:640,
|
||||
height: 640,
|
||||
url: faker.image.abstract(),
|
||||
width: 640,
|
||||
},
|
||||
{
|
||||
height:300,
|
||||
url:faker.image.abstract(),
|
||||
width:300,
|
||||
height: 300,
|
||||
url: faker.image.abstract(),
|
||||
width: 300,
|
||||
},
|
||||
{
|
||||
height:64,
|
||||
url:faker.image.abstract(),
|
||||
width:64,
|
||||
height: 64,
|
||||
url: faker.image.abstract(),
|
||||
width: 64,
|
||||
},
|
||||
],
|
||||
name:track,
|
||||
release_date:`${faker.date.past()}`.substring(0, 10),
|
||||
type:"album",
|
||||
name: track,
|
||||
release_date: `${faker.date.past()}`.substring(0, 10),
|
||||
type: "album",
|
||||
},
|
||||
artists:[
|
||||
artists: [
|
||||
{
|
||||
name:artist,
|
||||
type:"artist",
|
||||
name: artist,
|
||||
type: "artist",
|
||||
},
|
||||
],
|
||||
name:track,
|
||||
preview_url:faker.internet.url(),
|
||||
type:"track",
|
||||
name: track,
|
||||
preview_url: faker.internet.url(),
|
||||
type: "track",
|
||||
},
|
||||
played_at:`${faker.date.recent()}`,
|
||||
context:{
|
||||
type:"album",
|
||||
played_at: `${faker.date.recent()}`,
|
||||
context: {
|
||||
type: "album",
|
||||
},
|
||||
},
|
||||
],
|
||||
},
|
||||
})
|
||||
}
|
||||
else if (/me.top.tracks/.test(url) && (options?.headers?.Authorization === "Bearer MOCKED_TOKEN_ACCESS")) {
|
||||
else if (/me.top.tracks/.test(url) && (options?.headers?.Authorization === "Bearer MOCKED_TOKEN_ACCESS")) {
|
||||
console.debug(`metrics/compute/mocks > mocking spotify api result > ${url}`)
|
||||
const artist = faker.random.words()
|
||||
const track = faker.random.words(5)
|
||||
return ({
|
||||
status:200,
|
||||
data:{
|
||||
items:[
|
||||
status: 200,
|
||||
data: {
|
||||
items: [
|
||||
{
|
||||
album:{
|
||||
album_type:"single",
|
||||
artists:[
|
||||
album: {
|
||||
album_type: "single",
|
||||
artists: [
|
||||
{
|
||||
name:artist,
|
||||
type:"artist",
|
||||
name: artist,
|
||||
type: "artist",
|
||||
},
|
||||
],
|
||||
images:[
|
||||
images: [
|
||||
{
|
||||
height:640,
|
||||
url:faker.image.abstract(),
|
||||
width:640,
|
||||
height: 640,
|
||||
url: faker.image.abstract(),
|
||||
width: 640,
|
||||
},
|
||||
{
|
||||
height:300,
|
||||
url:faker.image.abstract(),
|
||||
width:300,
|
||||
height: 300,
|
||||
url: faker.image.abstract(),
|
||||
width: 300,
|
||||
},
|
||||
{
|
||||
height:64,
|
||||
url:faker.image.abstract(),
|
||||
width:64,
|
||||
height: 64,
|
||||
url: faker.image.abstract(),
|
||||
width: 64,
|
||||
},
|
||||
],
|
||||
name:track,
|
||||
release_date:`${faker.date.past()}`.substring(0, 10),
|
||||
type:"album",
|
||||
name: track,
|
||||
release_date: `${faker.date.past()}`.substring(0, 10),
|
||||
type: "album",
|
||||
},
|
||||
artists:[
|
||||
artists: [
|
||||
{
|
||||
name:artist,
|
||||
type:"artist",
|
||||
name: artist,
|
||||
type: "artist",
|
||||
},
|
||||
],
|
||||
name:track,
|
||||
preview_url:faker.internet.url(),
|
||||
type:"track",
|
||||
name: track,
|
||||
preview_url: faker.internet.url(),
|
||||
type: "track",
|
||||
},
|
||||
],
|
||||
},
|
||||
})
|
||||
}
|
||||
else if (/me.top.artists/.test(url) && (options?.headers?.Authorization === "Bearer MOCKED_TOKEN_ACCESS")) {
|
||||
else if (/me.top.artists/.test(url) && (options?.headers?.Authorization === "Bearer MOCKED_TOKEN_ACCESS")) {
|
||||
console.debug(`metrics/compute/mocks > mocking spotify api result > ${url}`)
|
||||
const genre = faker.random.words()
|
||||
const track = faker.random.words(5)
|
||||
return ({
|
||||
status:200,
|
||||
data:{
|
||||
items:[
|
||||
status: 200,
|
||||
data: {
|
||||
items: [
|
||||
{
|
||||
genres: [genre],
|
||||
images:[
|
||||
images: [
|
||||
{
|
||||
height:640,
|
||||
url:faker.image.abstract(),
|
||||
width:640,
|
||||
height: 640,
|
||||
url: faker.image.abstract(),
|
||||
width: 640,
|
||||
},
|
||||
{
|
||||
height:300,
|
||||
url:faker.image.abstract(),
|
||||
width:300,
|
||||
height: 300,
|
||||
url: faker.image.abstract(),
|
||||
width: 300,
|
||||
},
|
||||
{
|
||||
height:64,
|
||||
url:faker.image.abstract(),
|
||||
width:64,
|
||||
height: 64,
|
||||
url: faker.image.abstract(),
|
||||
width: 64,
|
||||
},
|
||||
],
|
||||
name:track,
|
||||
type:"artist",
|
||||
name: track,
|
||||
type: "artist",
|
||||
},
|
||||
],
|
||||
},
|
||||
|
||||
Reference in New Issue
Block a user