diff --git a/apps/server/src/app/__tests__/connection.integration.spec.ts b/apps/server/src/app/__tests__/connection.integration.spec.ts index 7eb81099..fe3710bc 100644 --- a/apps/server/src/app/__tests__/connection.integration.spec.ts +++ b/apps/server/src/app/__tests__/connection.integration.spec.ts @@ -1,21 +1,18 @@ import type { AxiosInstance } from 'axios' import type { SharedType } from '@maybe-finance/shared' -import type { Prisma, AccountConnection, AccountSyncStatus, User } from '@prisma/client' -import type { ItemRemoveResponse } from 'plaid' +import type { Prisma, AccountConnection, User } from '@prisma/client' import { startServer, stopServer } from './utils/server' import { getAxiosClient } from './utils/axios' import prisma from '../lib/prisma' -import { TestUtil } from '@maybe-finance/shared' import { InMemoryQueue } from '@maybe-finance/server/shared' -import { default as _plaid } from '../lib/plaid' +import { default as _teller } from '../lib/teller' import nock from 'nock' import { resetUser } from './utils/user' -jest.mock('../middleware/validate-plaid-jwt.ts') -jest.mock('plaid') +jest.mock('../lib/teller.ts') // For TypeScript support -const plaid = jest.mocked(_plaid) +const teller = jest.mocked(_teller) const authId = '__TEST_USER_ID__' let axios: AxiosInstance @@ -49,13 +46,13 @@ beforeEach(async () => { connectionData = { data: { name: 'Chase Test', - type: 'plaid' as SharedType.AccountConnectionType, - plaidItemId: 'test-plaid-item-server', - plaidInstitutionId: 'ins_3', - plaidAccessToken: - 'U2FsdGVkX1+WMq9lfTS9Zkbgrn41+XT1hvSK5ain/udRPujzjVCAx/lyPG7EumVZA+nVKXPauGwI+d7GZgtqTA9R3iCZNusU6LFPnmFOCE4=', - userId: user!.id, - syncStatus: 'PENDING' as AccountSyncStatus, + type: 'teller' as SharedType.AccountConnectionType, + tellerEnrollmentId: 'test-teller-item-workers', + tellerInstitutionId: 'chase_test', + tellerAccessToken: + 'U2FsdGVkX1+WMq9lfTS9Zkbgrn41+XT1hvSK5ain/udRPujzjVCAx/lyPG7EumVZA+nVKXPauGwI+d7GZgtqTA9R3iCZNusU6LFPnmFOCE4=', // need correct encoding here + userId: user.id, + syncStatus: 'PENDING', }, } @@ -91,16 +88,9 @@ describe('/v1/connections API', () => { }) it('DELETE /:id', async () => { - plaid.itemRemove.mockResolvedValueOnce( - TestUtil.axiosSuccess({ - request_id: 'test request id', - }) - ) - const res = await axios.delete(`/connections/${connection.id}`) expect(res.status).toEqual(200) - expect(plaid.itemRemove).toHaveBeenCalledTimes(1) const res2 = await axios.get(`/connections/${connection.id}`) diff --git a/apps/server/src/app/__tests__/insights.integration.spec.ts b/apps/server/src/app/__tests__/insights.integration.spec.ts index 9dbe0433..89694f6f 100644 --- a/apps/server/src/app/__tests__/insights.integration.spec.ts +++ b/apps/server/src/app/__tests__/insights.integration.spec.ts @@ -1,4 +1,4 @@ -import type { User } from '@prisma/client' +import { InvestmentTransactionCategory, type User } from '@prisma/client' import { Prisma, PrismaClient } from '@prisma/client' import { createLogger, transports } from 'winston' import { DateTime } from 'luxon' @@ -305,8 +305,7 @@ describe('insight service', () => { amount: 50 * 100, quantity: 50, price: 100, - plaidType: 'buy', - plaidSubtype: 'buy', + category: InvestmentTransactionCategory.buy, }, { accountId: account.id, @@ -316,8 +315,7 @@ describe('insight service', () => { amount: 10 * 200, quantity: 10, price: 200, - plaidType: 'buy', - plaidSubtype: 'buy', + category: InvestmentTransactionCategory.buy, }, { accountId: account.id, @@ -327,8 +325,7 @@ describe('insight service', () => { amount: -20.22, quantity: 0, price: 0, - plaidType: 'cash', - plaidSubtype: 'dividend', + category: InvestmentTransactionCategory.dividend, }, { accountId: account.id, @@ -338,8 +335,7 @@ describe('insight service', () => { amount: -22.85, quantity: 0, price: 0, - plaidType: 'cash', - plaidSubtype: 'dividend', + category: InvestmentTransactionCategory.dividend, }, ], }) diff --git a/prisma/seed.ts b/prisma/seed.ts index 7448631e..bcdaa68f 100644 --- a/prisma/seed.ts +++ b/prisma/seed.ts @@ -8,22 +8,29 @@ const prisma = new PrismaClient() */ async function main() { const institutions: (Pick & { - providers: { provider: Provider; providerId: string; rank?: number }[] + providers: { provider: Provider; providerId: string; logoUrl: string; rank?: number }[] })[] = [ { id: 1, name: 'Capital One', providers: [ - { provider: 'PLAID', providerId: 'ins_9', rank: 1 }, - { provider: 'FINICITY', providerId: '170778' }, + { + provider: 'TELLER', + providerId: 'capital_one', + logoUrl: 'https://teller.io/images/banks/capital_one.jpg', + rank: 1, + }, ], }, { id: 2, - name: 'Discover Bank', + name: 'Wells Fargo', providers: [ - { provider: 'PLAID', providerId: 'ins_33' }, - { provider: 'FINICITY', providerId: '13796', rank: 1 }, + { + provider: 'TELLER', + providerId: 'wells_fargo', + logoUrl: 'https://teller.io/images/banks/wells_fargo.jpg', + }, ], }, ]