mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
test: update test to assert the note assertion itself
add failing test for Video handling
This commit is contained in:
@@ -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) => {
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user