test: update tests to allow title-less topics

This commit is contained in:
Julian Lam
2026-02-13 15:20:34 -05:00
parent 4ef9d5fa55
commit b1c097f84b

View File

@@ -100,13 +100,6 @@ describe('Topic\'s', () => {
});
});
it('should fail to create new topic with empty title', (done) => {
topics.post({ uid: fooUid, title: '', content: topic.content, cid: topic.categoryId }, (err) => {
assert.ok(err);
done();
});
});
it('should fail to create new topic with empty content', (done) => {
topics.post({ uid: fooUid, title: topic.title, content: '', cid: topic.categoryId }, (err) => {
assert.ok(err);
@@ -236,6 +229,27 @@ describe('Topic\'s', () => {
assert.strictEqual(replyResult.body.response.user.displayname, 'guest124');
meta.config.allowGuestHandles = oldValue;
});
describe('without a title', () => {
before(function () {
this.payload = {
uid: topic.userId,
// title: '',
content: topic.content,
cid: topic.categoryId,
};
});
it('should create a new topic', async function () {
this.result = await topics.post(this.payload);
assert(this.result);
});
it('should contain a generated title', function () {
assert.strictEqual(this.result.title, this.result.content);
assert(this.result.topicData.generatedTitle);
});
});
});
describe('.reply', () => {