Files
xarticleaudio/test/convex-functions.test.js

33 lines
1.6 KiB
JavaScript

"use strict";
const test = require("node:test");
const assert = require("node:assert/strict");
const fs = require("node:fs");
test("convex state functions are present for configured function names", () => {
const schema = fs.readFileSync("convex/schema.ts", "utf8");
const state = fs.readFileSync("convex/state.ts", "utf8");
const domain = fs.readFileSync("convex/domain.ts", "utf8");
assert.match(schema, /users: defineTable/);
assert.match(schema, /wallets: defineTable/);
assert.match(schema, /wallet_transactions: defineTable/);
assert.match(schema, /mention_events: defineTable/);
assert.match(schema, /articles: defineTable/);
assert.match(schema, /audio_jobs: defineTable/);
assert.match(schema, /audio_assets: defineTable/);
assert.match(schema, /audio_access_grants: defineTable/);
assert.match(schema, /payment_events: defineTable/);
assert.match(schema, /state_snapshots/);
assert.match(state, /export const getLatestSnapshot = query/);
assert.match(state, /export const saveSnapshot = mutation/);
assert.match(domain, /export const upsertUser = mutation/);
assert.match(domain, /export const applyWalletTransaction = mutation/);
assert.match(domain, /export const recordMentionEvent = mutation/);
assert.match(domain, /export const upsertArticle = mutation/);
assert.match(domain, /export const createAudioJob = mutation/);
assert.match(domain, /export const createAudioAsset = mutation/);
assert.match(domain, /export const grantAudioAccess = mutation/);
assert.match(domain, /export const recordPaymentEvent = mutation/);
});