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