|
|
|
@ -1769,10 +1769,10 @@ describe('Topic\'s', () => {
|
|
|
|
|
assert.equal(data.matchCount, 4);
|
|
|
|
|
assert.equal(data.pageCount, 1);
|
|
|
|
|
const tagData = [
|
|
|
|
|
{ value: 'nodebb', valueEscaped: 'nodebb', score: 3, class: 'nodebb' },
|
|
|
|
|
{ value: 'node icon', valueEscaped: 'node icon', score: 1, class: 'node-icon' },
|
|
|
|
|
{ value: 'nodejs', valueEscaped: 'nodejs', score: 1, class: 'nodejs' },
|
|
|
|
|
{ value: 'nosql', valueEscaped: 'nosql', score: 1, class: 'nosql' },
|
|
|
|
|
{ value: 'nodebb', valueEscaped: 'nodebb', valueEncoded: 'nodebb', score: 3, class: 'nodebb' },
|
|
|
|
|
{ value: 'node icon', valueEscaped: 'node icon', valueEncoded: 'node%20icon', score: 1, class: 'node-icon' },
|
|
|
|
|
{ value: 'nodejs', valueEscaped: 'nodejs', valueEncoded: 'nodejs', score: 1, class: 'nodejs' },
|
|
|
|
|
{ value: 'nosql', valueEscaped: 'nosql', valueEncoded: 'nosql', score: 1, class: 'nosql' },
|
|
|
|
|
];
|
|
|
|
|
assert.deepEqual(data.tags, tagData);
|
|
|
|
|
|
|
|
|
@ -2012,17 +2012,17 @@ describe('Topic\'s', () => {
|
|
|
|
|
await topics.post({ uid: adminUid, tags: ['cattag1'], title: title, content: 'topic 1 content', cid: cid });
|
|
|
|
|
let result = await topics.getCategoryTagsData(cid, 0, -1);
|
|
|
|
|
assert.deepStrictEqual(result, [
|
|
|
|
|
{ value: 'cattag1', score: 3, valueEscaped: 'cattag1', class: 'cattag1' },
|
|
|
|
|
{ value: 'cattag2', score: 2, valueEscaped: 'cattag2', class: 'cattag2' },
|
|
|
|
|
{ value: 'cattag3', score: 1, valueEscaped: 'cattag3', class: 'cattag3' },
|
|
|
|
|
{ value: 'cattag1', score: 3, valueEscaped: 'cattag1', valueEncoded: 'cattag1', class: 'cattag1' },
|
|
|
|
|
{ value: 'cattag2', score: 2, valueEscaped: 'cattag2', valueEncoded: 'cattag2', class: 'cattag2' },
|
|
|
|
|
{ value: 'cattag3', score: 1, valueEscaped: 'cattag3', valueEncoded: 'cattag3', class: 'cattag3' },
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
// after purging values should update properly
|
|
|
|
|
await topics.purge(postResult.topicData.tid, adminUid);
|
|
|
|
|
result = await topics.getCategoryTagsData(cid, 0, -1);
|
|
|
|
|
assert.deepStrictEqual(result, [
|
|
|
|
|
{ value: 'cattag1', score: 2, valueEscaped: 'cattag1', class: 'cattag1' },
|
|
|
|
|
{ value: 'cattag2', score: 1, valueEscaped: 'cattag2', class: 'cattag2' },
|
|
|
|
|
{ value: 'cattag1', score: 2, valueEscaped: 'cattag1', valueEncoded: 'cattag1', class: 'cattag1' },
|
|
|
|
|
{ value: 'cattag2', score: 1, valueEscaped: 'cattag2', valueEncoded: 'cattag2', class: 'cattag2' },
|
|
|
|
|
]);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
@ -2041,11 +2041,11 @@ describe('Topic\'s', () => {
|
|
|
|
|
let result1 = await topics.getCategoryTagsData(cid1, 0, -1);
|
|
|
|
|
let result2 = await topics.getCategoryTagsData(cid2, 0, -1);
|
|
|
|
|
assert.deepStrictEqual(result1, [
|
|
|
|
|
{ value: 'movedtag1', score: 2, valueEscaped: 'movedtag1', class: 'movedtag1' },
|
|
|
|
|
{ value: 'movedtag2', score: 1, valueEscaped: 'movedtag2', class: 'movedtag2' },
|
|
|
|
|
{ value: 'movedtag1', score: 2, valueEscaped: 'movedtag1', valueEncoded: 'movedtag1', class: 'movedtag1' },
|
|
|
|
|
{ value: 'movedtag2', score: 1, valueEscaped: 'movedtag2', valueEncoded: 'movedtag2', class: 'movedtag2' },
|
|
|
|
|
]);
|
|
|
|
|
assert.deepStrictEqual(result2, [
|
|
|
|
|
{ value: 'movedtag2', score: 1, valueEscaped: 'movedtag2', class: 'movedtag2' },
|
|
|
|
|
{ value: 'movedtag2', score: 1, valueEscaped: 'movedtag2', valueEncoded: 'movedtag2', class: 'movedtag2' },
|
|
|
|
|
]);
|
|
|
|
|
|
|
|
|
|
// after moving values should update properly
|
|
|
|
@ -2054,11 +2054,11 @@ describe('Topic\'s', () => {
|
|
|
|
|
result1 = await topics.getCategoryTagsData(cid1, 0, -1);
|
|
|
|
|
result2 = await topics.getCategoryTagsData(cid2, 0, -1);
|
|
|
|
|
assert.deepStrictEqual(result1, [
|
|
|
|
|
{ value: 'movedtag1', score: 1, valueEscaped: 'movedtag1', class: 'movedtag1' },
|
|
|
|
|
{ value: 'movedtag1', score: 1, valueEscaped: 'movedtag1', valueEncoded: 'movedtag1', class: 'movedtag1' },
|
|
|
|
|
]);
|
|
|
|
|
assert.deepStrictEqual(result2, [
|
|
|
|
|
{ value: 'movedtag2', score: 2, valueEscaped: 'movedtag2', class: 'movedtag2' },
|
|
|
|
|
{ value: 'movedtag1', score: 1, valueEscaped: 'movedtag1', class: 'movedtag1' },
|
|
|
|
|
{ value: 'movedtag2', score: 2, valueEscaped: 'movedtag2', valueEncoded: 'movedtag2', class: 'movedtag2' },
|
|
|
|
|
{ value: 'movedtag1', score: 1, valueEscaped: 'movedtag1', valueEncoded: 'movedtag1', class: 'movedtag1' },
|
|
|
|
|
]);
|
|
|
|
|
});
|
|
|
|
|
|
|
|
|
|