foundkey-js: Change Misskey import to foundkey

This commit is contained in:
Norm 2022-09-23 11:21:29 -04:00
parent f821512e75
commit 80468b1529
Signed by untrusted user: norm
GPG key ID: 7123E30E441E80DE
2 changed files with 16 additions and 16 deletions

View file

@ -1,45 +1,45 @@
import { expectType } from 'tsd';
import * as Misskey from '../src';
import * as foundkey from '../src';
describe('API', () => {
test('success', async () => {
const cli = new Misskey.api.APIClient({
const cli = new foundkey.api.APIClient({
origin: 'https://misskey.test',
credential: 'TOKEN'
});
const res = await cli.request('meta', { detail: true });
expectType<Misskey.entities.DetailedInstanceMetadata>(res);
expectType<foundkey.entities.DetailedInstanceMetadata>(res);
});
test('conditional respose type (meta)', async () => {
const cli = new Misskey.api.APIClient({
const cli = new foundkey.api.APIClient({
origin: 'https://misskey.test',
credential: 'TOKEN'
});
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 });
expectType<Misskey.entities.LiteInstanceMetadata>(res2);
expectType<foundkey.entities.LiteInstanceMetadata>(res2);
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 });
expectType<Misskey.entities.LiteInstanceMetadata | Misskey.entities.DetailedInstanceMetadata>(res4);
expectType<foundkey.entities.LiteInstanceMetadata | foundkey.entities.DetailedInstanceMetadata>(res4);
});
test('conditional respose type (users/show)', async () => {
const cli = new Misskey.api.APIClient({
const cli = new foundkey.api.APIClient({
origin: 'https://misskey.test',
credential: 'TOKEN'
});
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'] });
expectType<Misskey.entities.UserDetailed[]>(res2);
expectType<foundkey.entities.UserDetailed[]>(res2);
});
});

View file

@ -1,17 +1,17 @@
import { expectType } from 'tsd';
import * as Misskey from '../src';
import * as foundkey from '../src';
describe('Streaming', () => {
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');
mainChannel.on('notification', notification => {
expectType<Misskey.entities.Notification>(notification);
expectType<foundkey.entities.Notification>(notification);
});
});
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 の第二引数として受け入れる型が
// {
// otherparty?: User['id'] | null;
@ -20,7 +20,7 @@ describe('Streaming', () => {
// になっている」というテストを行いたいけどtsdでの書き方がわからない
const messagingChannel = stream.useChannel('messaging', { otherparty: 'aaa' });
messagingChannel.on('message', message => {
expectType<Misskey.entities.MessagingMessage>(message);
expectType<foundkey.entities.MessagingMessage>(message);
});
});
});