sinon.stub(axios, 'create').callsFake(({baseURL = 'localhost'} = {}) => ({ post: (path, data) => { baseURL.should.equal(endpoints[counter].url); path.should.equal('/metrics/v2/' + id); data.prisoner.should.equal('valjean');
/** * Return API endpoint for this user */ url(...args) { return super.url(this.id ? `users/${this.id}` : 'user', ...args); }
// Connecting to the database mongoose .connect(URL_MONGO.url, { useNewUrlParser: true, }) .then(() => { console.log("Successfully connected to the database"); }) .catch((err) => { console.log("Could not connect to the database. Exiting now...", err); process.exit(); });
action('handleLogin', (respBody, appRouter) => { this.appInfo = { serverIP: respBody.serverIP, version: respBody.version, startupDate: respBody.startupDate }; appRouter.push(defaultPage.url); // appRouter.replace('/admin/login'); })
function getArtistImage(artist, song_url, searchLimit){ var searchLimit = (typeof searchLimit !== 'undefined') ? searchLimit : 10; spotifyApi.searchArtists(artist, {limit: searchLimit}, function(err, data){ if(!err){ var img_url = data.artists.items[0].images[0].url; showArtistImage(img_url) } else { console.log("ERROR: " + err); } playMusic(song_url) }) }
const getMappingUrl = (requestPath) => { const requestPathSplitted = requestPath.split('/'); let requestPathSlittedSecondItem = requestPathSplitted.length && requestPathSplitted.length > 1 ? requestPathSplitted[1] : null; if (requestPathSlittedSecondItem) { requestPathSlittedSecondItem = requestPathSlittedSecondItem.toLowerCase(); const filteredServiceHosts = serviceHosts.filter(service => service.serviceName === requestPathSlittedSecondItem); if (filteredServiceHosts.length) { return filteredServiceHosts[0].url; } } return null; }
constructor(data) { invariant(data, missingArgument({ data })) this.id = `${data?.id}-${data?.label.replace(` `, `_`)}` this.photoId = data?.id this.canBlog = !!data?.canBlog this.canPrint = !!data?.canPrint this.canDownload = !!data?.canDownload this.size = data?.label.replace(` `, `_`) this.width = data?.width this.height = data?.height this.source = decodeURI(data?.source) this.url = decodeURI(data?.url) this.media = data?.media }
render() { const {pictureIndex} = this.props.match.params return ( <div className="app-content-width"> <article> <h2>{pictures[pictureIndex].name}</h2> <p>It is only about a single picture. Go back to <Link to="/pictures">gallery</Link></p> <div className="Picture-full"> <img src={pictures[pictureIndex].url} alt="Nice one"/> </div> </article> </div> ) }
getData(sources[i].url, (err, data) => { counter-- if (!err) { let arr = sources[i].deXml(data) if (arr) { dymicArr = dymicArr.concat(arr) } } if (counter == 0) { hostToIP(dymicArr, callback) } })
spotifyApi.searchTracks(query, {limit:searchLimit}, function(err,data){ if(!err){ var randomSong = Math.floor(Math.random()*searchLimit); var song = data.tracks.items[randomSong] var url = song.preview_url var artistName = song.artists[0].name; var albumCover = song.album.images[0].url; var albumName = song.album.name getArtistImage(artistName ,url) } else { console.log("ERROR: " + err) } })
async resolve(expense, args, req) { if (!(await canSeeExpenseAttachments(req, expense))) { return null; } else { const attachments = await getExpenseItems(expense.id, req); return attachments[0] && attachments[0].url; } }
/** * Return API endpoint for this application */ url(...args) { return super.url('installation', ...args); }
/** * Return API endpoint for this organization */ url(...args) { return super.url(`orgs/${this.id}`, ...args); }
/** * Return API endpoint for this application */ url(...args) { return super.url(`applications/${this.id}`, ...args); }
/** * Return API endpoint for this application */ url(...args) { return super.url(`repos/${this.id}`, ...args); }