Skip to content

Commit

Permalink
feat: adds test coverage before refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
cesarenaldi committed Dec 11, 2024
1 parent 6085910 commit 3a602f6
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 0 deletions.
25 changes: 25 additions & 0 deletions packages/client/src/actions/account.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { testnet } from '@lens-protocol/env';
import { assertOk, evmAddress } from '@lens-protocol/types';
import { describe, it } from 'vitest';

import { FullAccountFragment } from '@lens-protocol/graphql';
import { PublicClient } from '../clients';
import { fetchAccount } from './account';

describe('Given the Account query actions', () => {
const client = PublicClient.create({
environment: testnet,
origin: 'http://example.com',
accountFragment: FullAccountFragment,
});

describe(`When invoking the '${fetchAccount.name}' action`, () => {
it('Then it should not fail w/ a GQL BadRequest error', async () => {
const result = await fetchAccount(client, {
address: evmAddress(import.meta.env.TEST_ACCOUNT),
});
console.log(result);
assertOk(result);
});
});
});
15 changes: 15 additions & 0 deletions packages/client/src/actions/notifications.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { assertOk } from '@lens-protocol/types';
import { describe, it } from 'vitest';

import { loginAsAccountOwner } from '../../testing-utils';
import { fetchNotifications } from './notifications';

describe(`Given the '${fetchNotifications.name}' action`, () => {
describe('When invoked', () => {
it('Then it should not fail w/ a GQL BadRequest error', async () => {
const result = await loginAsAccountOwner().andThen(fetchNotifications);

assertOk(result);
});
});
});

0 comments on commit 3a602f6

Please sign in to comment.