Skip to content

Commit

Permalink
chore: add more tests
Browse files Browse the repository at this point in the history
  • Loading branch information
bigint committed Nov 19, 2023
1 parent a3f645a commit 4ec6da0
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 0 deletions.
14 changes: 14 additions & 0 deletions apps/api/tests/ipfs/pin.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import { TEST_ENDPOINT } from '@utils/constants';
import axios from 'axios';
import urlcat from 'urlcat';
import { describe, expect, test } from 'vitest';

describe('ipfs/pin', () => {
test('should pin on lens ipfs', async () => {
const cid = 'bafybeid7g3owl4owey7qjfcjfx7acmmimhaxtqka4pgt7tphcgqo5dwznu';
const { data } = await axios.post(
urlcat(TEST_ENDPOINT, '/ipfs/pin', { cid })
);
expect(data.cid).toBe(cid);
});
});
22 changes: 22 additions & 0 deletions apps/api/tests/oembed/oembed.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
import { TEST_ENDPOINT } from '@utils/constants';
import axios from 'axios';
import urlcat from 'urlcat';
import { describe, expect, test } from 'vitest';

describe('oembed', () => {
test('should return hey member nft status', async () => {
const { data } = await axios.get(
urlcat(TEST_ENDPOINT, '/oembed', {
url: 'https://github.com/heyxyz/hey'
})
);
expect(data.oembed.url).toContain('https://github.com/heyxyz/hey');
expect(data.oembed.title).toContain('GitHub - heyxyz/hey');
expect(data.oembed.description).toContain(
'decentralized and permissionless'
);
expect(data.oembed.image).toContain('https://ik.imagekit.io');
expect(data.oembed.site).toContain('GitHub');
expect(data.oembed.isLarge).toBeTruthy();
});
});
15 changes: 15 additions & 0 deletions apps/api/tests/preference/getHeyMemberNftStatus.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { TEST_ENDPOINT } from '@utils/constants';
import axios from 'axios';
import urlcat from 'urlcat';
import { describe, expect, test } from 'vitest';

describe('preference/getHeyMemberNftStatus', () => {
test('should return hey member nft status', async () => {
const { data } = await axios.get(
urlcat(TEST_ENDPOINT, '/preference/getHeyMemberNftStatus', {
id: '0x03Ba34f6Ea1496fa316873CF8350A3f7eaD317EF'
})
);
expect(data.result.dismissedOrMinted).toBeTruthy();
});
});
16 changes: 16 additions & 0 deletions apps/api/tests/preference/getPreferences.spec.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
import { TEST_ENDPOINT } from '@utils/constants';
import axios from 'axios';
import urlcat from 'urlcat';
import { describe, expect, test } from 'vitest';

describe('preference/getPreferences', () => {
test('should return preference of a profile', async () => {
const { data } = await axios.get(
urlcat(TEST_ENDPOINT, '/preference/getPreferences', {
id: '0x01b69c'
})
);
expect(data.result.is_pride).toBeTruthy();
expect(data.result.high_signal_notification_filter).toBeTruthy();
});
});

2 comments on commit 4ec6da0

@vercel
Copy link

@vercel vercel bot commented on 4ec6da0 Nov 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

prerender – ./apps/prerender

prerender-git-main-heyxyz.vercel.app
prerender.hey.xyz
prerender-heyxyz.vercel.app

@vercel
Copy link

@vercel vercel bot commented on 4ec6da0 Nov 19, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

api – ./apps/api

api-git-main-heyxyz.vercel.app
api-heyxyz.vercel.app
api.hey.xyz
hey-api.vercel.app

Please sign in to comment.