Merge pull request #253 from h3poteto/detector/example

Add spec for detector
This commit is contained in:
AkiraFukushima 2020-03-13 22:17:27 +09:00 committed by GitHub
commit 67fa69ba20
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 37 additions and 5 deletions

View file

@ -1,23 +1,20 @@
import MastodonAPI from './mastodon/api_client'
import Response from './response'
import OAuth from './oauth'
import { isCancel, RequestCanceledError } from './cancel'
import { ProxyConfig } from './proxy_config'
//
import generator, { MegalodonInterface, WebSocketInterface, StreamListenerInterface } from './megalodon'
import generator, { detector, MegalodonInterface, WebSocketInterface, StreamListenerInterface } from './megalodon'
import Mastodon from './mastodon'
import Pleroma from './pleroma'
import Misskey from './misskey'
import Entity from './entity'
export {
MastodonAPI,
Response,
OAuth,
RequestCanceledError,
isCancel,
ProxyConfig,
//
detector,
MegalodonInterface,
WebSocketInterface,
StreamListenerInterface,

View file

@ -0,0 +1,35 @@
import { detector } from '../../src/index'
describe('detector', () => {
describe('mastodon', () => {
const url = 'https://mastodon.social'
it('should be mastodon', async () => {
const mastodon = await detector(url)
expect(mastodon).toEqual('mastodon')
})
})
describe('pleroma', () => {
const url = 'https://pleroma.io'
it('should be pleroma', async () => {
const pleroma = await detector(url)
expect(pleroma).toEqual('pleroma')
})
})
describe('misskey', () => {
const url = 'https://misskey.io'
it('should be misskey', async () => {
const misskey = await detector(url)
expect(misskey).toEqual('misskey')
})
})
describe('pixelfed', () => {
const url = 'https://pixelfed.tokyo'
it('should be pixelfed', async () => {
const pixelfed = await detector(url)
expect(pixelfed).toEqual('pixelfed')
})
})
})