Merge pull request #253 from h3poteto/detector/example
Add spec for detector
This commit is contained in:
commit
67fa69ba20
|
@ -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,
|
||||
|
|
35
test/integration/megalodon.spec.ts
Normal file
35
test/integration/megalodon.spec.ts
Normal 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')
|
||||
})
|
||||
})
|
||||
})
|
Loading…
Reference in a new issue