Skip to content

Node.js based forum software built for the modern web

test: update test to assert the note assertion itself

Julian Lamc6ba56a51719
diff --git a/src/activitypub/helpers.js b/src/activitypub/helpers.js
index 2311db66b5..9e7da42b00 100644
--- a/src/activitypub/helpers.js
+++ b/src/activitypub/helpers.js
@@ -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) => {
diff --git a/test/activitypub/notes.js b/test/activitypub/notes.js
index 6a27c5904b..77d7a18677 100644
--- a/test/activitypub/notes.js
+++ b/test/activitypub/notes.js
@@ -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);