test: update test to assert the note assertion itself

add failing test for Video handling
This commit is contained in:
Julian Lam
2025-02-26 13:06:31 -05:00
parent c98f29aeb4
commit c6ba56a517
2 changed files with 28 additions and 5 deletions

View File

@@ -34,9 +34,9 @@ Helpers._test = (method, args) => {
console.log(await method.apply(method, args));
}, 2500);
};
// process.nextTick(() => {
// Helpers._test(activitypub.notes.assert, [1, `https://`]);
// });
process.nextTick(() => {
Helpers._test(activitypub.notes.assert, [1, `https://spectra.video/w/xwCSYfZh1mJY64zJ9GngbE`]);
});
let _lastLog;
Helpers.log = (message) => {

View File

@@ -25,7 +25,11 @@ describe('Notes', () => {
describe('Public objects', () => {
it('should pull a remote root-level object by its id and create a new topic', async () => {
const { id } = helpers.mocks.note();
const { tid, count } = await activitypub.notes.assert(0, id, { skipChecks: true });
const assertion = await activitypub.notes.assert(0, id, { skipChecks: true });
assert(assertion);
const { tid, count } = assertion;
assert(tid);
assert.strictEqual(count, 1);
const exists = await topics.exists(tid);
@@ -34,7 +38,26 @@ describe('Notes', () => {
it('should assert if the cc property is missing', async () => {
const { id } = helpers.mocks.note({ cc: 'remove' });
const { tid, count } = await activitypub.notes.assert(0, id, { skipChecks: true });
const assertion = await activitypub.notes.assert(0, id, { skipChecks: true });
assert(assertion);
const { tid, count } = assertion;
assert(tid);
assert.strictEqual(count, 1);
const exists = await topics.exists(tid);
assert(exists);
});
it('should assert if the object is of type Video', async () => {
const { id } = helpers.mocks.note({
type: 'Video',
});
const assertion = await activitypub.notes.assert(0, id, { skipChecks: true });
assert(assertion);
const { tid, count } = assertion;
assert(tid);
assert.strictEqual(count, 1);
const exists = await topics.exists(tid);