Update remaining Misskey references #171
2 changed files with 16 additions and 16 deletions
|
@ -1,45 +1,45 @@
|
||||||
import { expectType } from 'tsd';
|
import { expectType } from 'tsd';
|
||||||
import * as Misskey from '../src';
|
import * as foundkey from '../src';
|
||||||
|
|
||||||
describe('API', () => {
|
describe('API', () => {
|
||||||
test('success', async () => {
|
test('success', async () => {
|
||||||
const cli = new Misskey.api.APIClient({
|
const cli = new foundkey.api.APIClient({
|
||||||
origin: 'https://misskey.test',
|
origin: 'https://misskey.test',
|
||||||
credential: 'TOKEN'
|
credential: 'TOKEN'
|
||||||
});
|
});
|
||||||
const res = await cli.request('meta', { detail: true });
|
const res = await cli.request('meta', { detail: true });
|
||||||
expectType<Misskey.entities.DetailedInstanceMetadata>(res);
|
expectType<foundkey.entities.DetailedInstanceMetadata>(res);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('conditional respose type (meta)', async () => {
|
test('conditional respose type (meta)', async () => {
|
||||||
const cli = new Misskey.api.APIClient({
|
const cli = new foundkey.api.APIClient({
|
||||||
origin: 'https://misskey.test',
|
origin: 'https://misskey.test',
|
||||||
credential: 'TOKEN'
|
credential: 'TOKEN'
|
||||||
});
|
});
|
||||||
|
|
||||||
const res = await cli.request('meta', { detail: true });
|
const res = await cli.request('meta', { detail: true });
|
||||||
expectType<Misskey.entities.DetailedInstanceMetadata>(res);
|
expectType<foundkey.entities.DetailedInstanceMetadata>(res);
|
||||||
|
|
||||||
const res2 = await cli.request('meta', { detail: false });
|
const res2 = await cli.request('meta', { detail: false });
|
||||||
expectType<Misskey.entities.LiteInstanceMetadata>(res2);
|
expectType<foundkey.entities.LiteInstanceMetadata>(res2);
|
||||||
|
|
||||||
const res3 = await cli.request('meta', { });
|
const res3 = await cli.request('meta', { });
|
||||||
expectType<Misskey.entities.LiteInstanceMetadata>(res3);
|
expectType<foundkey.entities.LiteInstanceMetadata>(res3);
|
||||||
|
|
||||||
const res4 = await cli.request('meta', { detail: true as boolean });
|
const res4 = await cli.request('meta', { detail: true as boolean });
|
||||||
expectType<Misskey.entities.LiteInstanceMetadata | Misskey.entities.DetailedInstanceMetadata>(res4);
|
expectType<foundkey.entities.LiteInstanceMetadata | foundkey.entities.DetailedInstanceMetadata>(res4);
|
||||||
});
|
});
|
||||||
|
|
||||||
test('conditional respose type (users/show)', async () => {
|
test('conditional respose type (users/show)', async () => {
|
||||||
const cli = new Misskey.api.APIClient({
|
const cli = new foundkey.api.APIClient({
|
||||||
origin: 'https://misskey.test',
|
origin: 'https://misskey.test',
|
||||||
credential: 'TOKEN'
|
credential: 'TOKEN'
|
||||||
});
|
});
|
||||||
|
|
||||||
const res = await cli.request('users/show', { userId: 'xxxxxxxx' });
|
const res = await cli.request('users/show', { userId: 'xxxxxxxx' });
|
||||||
expectType<Misskey.entities.UserDetailed>(res);
|
expectType<foundkey.entities.UserDetailed>(res);
|
||||||
|
|
||||||
const res2 = await cli.request('users/show', { userIds: ['xxxxxxxx'] });
|
const res2 = await cli.request('users/show', { userIds: ['xxxxxxxx'] });
|
||||||
expectType<Misskey.entities.UserDetailed[]>(res2);
|
expectType<foundkey.entities.UserDetailed[]>(res2);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
|
@ -1,17 +1,17 @@
|
||||||
import { expectType } from 'tsd';
|
import { expectType } from 'tsd';
|
||||||
import * as Misskey from '../src';
|
import * as foundkey from '../src';
|
||||||
|
|
||||||
describe('Streaming', () => {
|
describe('Streaming', () => {
|
||||||
test('emit type', async () => {
|
test('emit type', async () => {
|
||||||
const stream = new Misskey.Stream('https://misskey.test', { token: 'TOKEN' });
|
const stream = new foundkey.Stream('https://misskey.test', { token: 'TOKEN' });
|
||||||
const mainChannel = stream.useChannel('main');
|
const mainChannel = stream.useChannel('main');
|
||||||
mainChannel.on('notification', notification => {
|
mainChannel.on('notification', notification => {
|
||||||
expectType<Misskey.entities.Notification>(notification);
|
expectType<foundkey.entities.Notification>(notification);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
test('params type', async () => {
|
test('params type', async () => {
|
||||||
const stream = new Misskey.Stream('https://misskey.test', { token: 'TOKEN' });
|
const stream = new foundkey.Stream('https://misskey.test', { token: 'TOKEN' });
|
||||||
// TODO: 「stream.useChannel の第二引数として受け入れる型が
|
// TODO: 「stream.useChannel の第二引数として受け入れる型が
|
||||||
// {
|
// {
|
||||||
// otherparty?: User['id'] | null;
|
// otherparty?: User['id'] | null;
|
||||||
|
@ -20,7 +20,7 @@ describe('Streaming', () => {
|
||||||
// になっている」というテストを行いたいけどtsdでの書き方がわからない
|
// になっている」というテストを行いたいけどtsdでの書き方がわからない
|
||||||
const messagingChannel = stream.useChannel('messaging', { otherparty: 'aaa' });
|
const messagingChannel = stream.useChannel('messaging', { otherparty: 'aaa' });
|
||||||
messagingChannel.on('message', message => {
|
messagingChannel.on('message', message => {
|
||||||
expectType<Misskey.entities.MessagingMessage>(message);
|
expectType<foundkey.entities.MessagingMessage>(message);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
Loading…
Reference in a new issue