Skip to content

Commit

Permalink
test: add ping endpoint
Browse files Browse the repository at this point in the history
  • Loading branch information
Kikobeats committed Aug 12, 2024
1 parent b270c12 commit e140dd4
Showing 1 changed file with 51 additions and 20 deletions.
71 changes: 51 additions & 20 deletions test/providers.js → test/endpoints.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,145 +7,176 @@ const { runServer } = require('./helpers')

const isCI = !!process.env.CI

test('ping', async t => {
const serverUrl = await runServer(t)
const { body, statusCode } = await got('ping', {
prefixUrl: serverUrl,
responseType: 'text'
})
t.is(statusCode, 200)
t.is(body, 'pong')
})

test('youtube', async t => {
const serverUrl = await runServer(t)
const { body } = await got('youtube/natelive7?json', {
const { body, statusCode } = await got('youtube/natelive7?json', {
prefixUrl: serverUrl
})
t.is(statusCode, 200)
t.true(body.url.includes('images.weserv.nl'))
})

test('gitlab', async t => {
const serverUrl = await runServer(t)
const { body } = await got('gitlab/kikobeats?json', {
const { body, statusCode } = await got('gitlab/kikobeats?json', {
prefixUrl: serverUrl
})
t.is(statusCode, 200)
t.true(body.url.includes('images.weserv.nl'))
})

test('github', async t => {
const serverUrl = await runServer(t)
const { body } = await got('github/kikobeats?json', {
const { body, statusCode } = await got('github/kikobeats?json', {
prefixUrl: serverUrl
})
t.is(statusCode, 200)
t.true(body.url.includes('images.weserv.nl'))
})

test('twitter', async t => {
const serverUrl = await runServer(t)
const { body } = await got('twitter/kikobeats?json', {
const { body, statusCode } = await got('twitter/kikobeats?json', {
prefixUrl: serverUrl
})
t.is(statusCode, 200)
t.true(body.url.includes('images.weserv.nl'))
})

test('soundcloud', async t => {
const serverUrl = await runServer(t)
const { body } = await got('soundcloud/kikobeats?json', {
const { body, statusCode } = await got('soundcloud/kikobeats?json', {
prefixUrl: serverUrl
})
t.is(statusCode, 200)
t.true(body.url.includes('images.weserv.nl'))
})
//
test('deviantart', async t => {
const serverUrl = await runServer(t)
const { body } = await got('deviantart/spyed?json', {
const { body, statusCode } = await got('deviantart/spyed?json', {
prefixUrl: serverUrl
})
t.is(statusCode, 200)
t.true(body.url.includes('images.weserv.nl'))
})

test('dribbble', async t => {
const serverUrl = await runServer(t)
const { body } = await got('dribbble/omidnikrah?json', {
const { body, statusCode } = await got('dribbble/omidnikrah?json', {
prefixUrl: serverUrl
})
t.is(statusCode, 200)
t.true(body.url.includes('images.weserv.nl'))
})

test('duckduckgo', async t => {
const serverUrl = await runServer(t)
const { body } = await got('duckduckgo/google.com?json', {
const { body, statusCode } = await got('duckduckgo/google.com?json', {
prefixUrl: serverUrl
})
t.is(statusCode, 200)
t.true(body.url.includes('images.weserv.nl'))
})

test('google', async t => {
const serverUrl = await runServer(t)
const { body } = await got('google/teslahunt.io?json', {
const { body, statusCode } = await got('google/teslahunt.io?json', {
prefixUrl: serverUrl
})
t.is(statusCode, 200)
t.true(body.url.includes('images.weserv.nl'))
})

test('gravatar', async t => {
const serverUrl = await runServer(t)
const { body } = await got('gravatar/[email protected]?json', {
prefixUrl: serverUrl
})
const { body, statusCode } = await got(
'gravatar/[email protected]?json',
{
prefixUrl: serverUrl
}
)
t.is(statusCode, 200)
t.true(body.url.includes('images.weserv.nl'))
})

test('telegram', async t => {
const serverUrl = await runServer(t)
const { body } = await got('telegram/drsdavidsoft?json', {
const { body, statusCode } = await got('telegram/drsdavidsoft?json', {
prefixUrl: serverUrl
})
t.is(statusCode, 200)
t.true(body.url.includes('images.weserv.nl'))
})
;(isCI ? test.skip : test)('substack', async t => {
const serverUrl = await runServer(t)
const { body } = await got('substack/bankless?json', {
const { body, statusCode } = await got('substack/bankless?json', {
prefixUrl: serverUrl
})
t.is(statusCode, 200)
t.true(body.url.includes('images.weserv.nl'))
})
//
;(isCI ? test.skip : test)('reddit', async t => {
const serverUrl = await runServer(t)
const { body } = await got('reddit/kikobeats?json', {
const { body, statusCode } = await got('reddit/kikobeats?json', {
prefixUrl: serverUrl
})
t.is(statusCode, 200)
t.true(body.url.includes('images.weserv.nl'))
})
//
;(isCI ? test.skip : test)('instagram', async t => {
const serverUrl = await runServer(t)
const { body } = await got('instagram/willsmith?json', {
const { body, statusCode } = await got('instagram/willsmith?json', {
prefixUrl: serverUrl
})
t.is(statusCode, 200)
t.true(body.url.includes('images.weserv.nl'))
})

test('twitch', async t => {
const serverUrl = await runServer(t)
const { body } = await got('twitch/midudev?json', {
const { body, statusCode } = await got('twitch/midudev?json', {
prefixUrl: serverUrl
})
t.is(statusCode, 200)
t.true(body.url.includes('images.weserv.nl'))
})

test('microlink', async t => {
const serverUrl = await runServer(t)
const { body } = await got('microlink/teslahunt.io?json', {
const { body, statusCode } = await got('microlink/teslahunt.io?json', {
prefixUrl: serverUrl
})
t.is(statusCode, 200)
t.true(body.url.includes('images.weserv.nl'))
})

test('readcv', async t => {
const serverUrl = await runServer(t)
const { body } = await got('readcv/elenatorro?json', {
const { body, statusCode } = await got('readcv/elenatorro?json', {
prefixUrl: serverUrl
})
t.is(statusCode, 200)
t.true(body.url.includes('images.weserv.nl'))
})
//
test.skip('tiktok', async t => {
const serverUrl = await runServer(t)
const { body } = await got('tiktok/carlosazaustre?json', {
const { body, statusCode } = await got('tiktok/carlosazaustre?json', {
prefixUrl: serverUrl
})
t.is(statusCode, 200)
t.true(body.url.includes('images.weserv.nl'))
})

0 comments on commit e140dd4

Please sign in to comment.