Update stuff so we can pass build hopefully
This commit is contained in:
@@ -1,17 +1,9 @@
|
||||
import { convexTest } from 'convex-test';
|
||||
import { makeFunctionReference } from 'convex/server';
|
||||
import { describe, expect, test } from 'vitest';
|
||||
|
||||
import { api } from '../../convex/_generated/api.js';
|
||||
import schema from '../../convex/schema';
|
||||
|
||||
const createManualSpoon = makeFunctionReference<'mutation'>(
|
||||
'spoons:createManual',
|
||||
);
|
||||
const listMySpoons = makeFunctionReference<'query'>('spoons:listMine');
|
||||
const getSpoon = makeFunctionReference<'query'>('spoons:get');
|
||||
const createAgentRequest = makeFunctionReference<'mutation'>(
|
||||
'agentRequests:create',
|
||||
);
|
||||
const modules = import.meta.glob('../../convex/**/*.*s');
|
||||
|
||||
const createUser = async (t: ReturnType<typeof convexTest>, email: string) =>
|
||||
@@ -49,9 +41,9 @@ describe('convex-test harness', () => {
|
||||
|
||||
test('requires authentication to create a Spoon', async () => {
|
||||
const t = convexTest(schema, modules);
|
||||
await expect(t.mutation(createManualSpoon, spoonInput)).rejects.toThrow(
|
||||
'Not authenticated.',
|
||||
);
|
||||
await expect(
|
||||
t.mutation(api.spoons.createManual, spoonInput),
|
||||
).rejects.toThrow('Not authenticated.');
|
||||
});
|
||||
|
||||
test('creates and lists Spoons for the current user', async () => {
|
||||
@@ -59,8 +51,8 @@ describe('convex-test harness', () => {
|
||||
const userId = await createUser(t, 'one@example.com');
|
||||
const session = authed(t, userId);
|
||||
|
||||
const spoonId = await session.mutation(createManualSpoon, spoonInput);
|
||||
const spoons = await session.query(listMySpoons, {});
|
||||
const spoonId = await session.mutation(api.spoons.createManual, spoonInput);
|
||||
const spoons = await session.query(api.spoons.listMine, {});
|
||||
|
||||
expect(spoons).toHaveLength(1);
|
||||
expect(spoons[0]?._id).toBe(spoonId);
|
||||
@@ -72,12 +64,12 @@ describe('convex-test harness', () => {
|
||||
const ownerId = await createUser(t, 'owner@example.com');
|
||||
const otherId = await createUser(t, 'other@example.com');
|
||||
const spoonId = await authed(t, ownerId).mutation(
|
||||
createManualSpoon,
|
||||
api.spoons.createManual,
|
||||
spoonInput,
|
||||
);
|
||||
|
||||
await expect(
|
||||
authed(t, otherId).query(getSpoon, { spoonId }),
|
||||
authed(t, otherId).query(api.spoons.get, { spoonId }),
|
||||
).rejects.toThrow('Spoon not found.');
|
||||
});
|
||||
|
||||
@@ -86,12 +78,12 @@ describe('convex-test harness', () => {
|
||||
const ownerId = await createUser(t, 'owner@example.com');
|
||||
const otherId = await createUser(t, 'other@example.com');
|
||||
const spoonId = await authed(t, ownerId).mutation(
|
||||
createManualSpoon,
|
||||
api.spoons.createManual,
|
||||
spoonInput,
|
||||
);
|
||||
|
||||
await expect(
|
||||
authed(t, otherId).mutation(createAgentRequest, {
|
||||
authed(t, otherId).mutation(api.agentRequests.create, {
|
||||
spoonId,
|
||||
prompt: 'Add a settings page',
|
||||
}),
|
||||
|
||||
Reference in New Issue
Block a user