Clean prepaid SoT, identity mailbox, public access planes, leaf policy, fleet spawn
Some checks are pending
offline / test (push) Waiting to run
Some checks are pending
offline / test (push) Waiting to run
Persist account-balance books; edge caches prepaid from books. Add zappier-identity, verae-nats-accounts, verae-jobs-events, verae-access-staff, zapier-decisions. Edge binds loopback; lan-134 stays off; HTTP services prefer local spawn.
This commit is contained in:
parent
345aeeead9
commit
ddf772454b
153 changed files with 2236 additions and 116 deletions
|
|
@ -1,7 +1,11 @@
|
|||
import { test } from 'node:test';
|
||||
import assert from 'node:assert/strict';
|
||||
import fs from 'node:fs';
|
||||
import os from 'node:os';
|
||||
import path from 'node:path';
|
||||
import { AccountBooks, handle } from '../src/books.js';
|
||||
import { SUBJECTS } from '../src/subjects.js';
|
||||
import { loadInto, saveFrom, booksPath } from '../src/persist.js';
|
||||
|
||||
test('adjust credits prepaid and statement lists credits usage payments', () => {
|
||||
const books = new AccountBooks();
|
||||
|
|
@ -19,3 +23,15 @@ test('adjust credits prepaid and statement lists credits usage payments', () =>
|
|||
assert.equal(st.usage[0].endpointId, 'timestamp');
|
||||
assert.equal(st.payments[0].kind, 'payment');
|
||||
});
|
||||
|
||||
test('persist round-trip keeps prepaid', () => {
|
||||
const dir = fs.mkdtempSync(path.join(os.tmpdir(), 'books-'));
|
||||
process.env.BOOKS_PATH = path.join(dir, 'books.json');
|
||||
const a = new AccountBooks();
|
||||
handle(SUBJECTS.BALANCE_ADJUST, { customerId: 'c9', cents: 120, kind: 'reload' }, a);
|
||||
saveFrom(a);
|
||||
assert.ok(fs.existsSync(booksPath()));
|
||||
const b = loadInto(new AccountBooks());
|
||||
assert.equal(b.prepaidCents('c9'), 120);
|
||||
delete process.env.BOOKS_PATH;
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue