mirror of
https://github.com/pieartsy/PluralFlux.git
synced 2026-04-16 17:45:28 +10:00
adding more cases to messageHelper tests
This commit is contained in:
@@ -57,8 +57,7 @@ msgh.parseProxyTags = async function (authorId, content, attachmentUrl = null){
|
|||||||
const splitProxy = member.proxy.split("text");
|
const splitProxy = member.proxy.split("text");
|
||||||
if(content.startsWith(splitProxy[0]) && content.endsWith(splitProxy[1])) {
|
if(content.startsWith(splitProxy[0]) && content.endsWith(splitProxy[1])) {
|
||||||
proxyMessage.member = member;
|
proxyMessage.member = member;
|
||||||
if (attachmentUrl) proxyMessage.hasAttachment = true;
|
proxyMessage.hasAttachment = !!attachmentUrl;
|
||||||
|
|
||||||
let escapedPrefix = splitProxy[0].replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
let escapedPrefix = splitProxy[0].replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||||
let escapedSuffix = splitProxy[1].replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
let escapedSuffix = splitProxy[1].replace(/[.*+?^${}()|[\]\\]/g, '\\$&');
|
||||||
escapedPrefix = new RegExp("^" + escapedPrefix);
|
escapedPrefix = new RegExp("^" + escapedPrefix);
|
||||||
|
|||||||
@@ -68,13 +68,13 @@ describe('messageHelper', () => {
|
|||||||
|
|
||||||
test.each([
|
test.each([
|
||||||
['1', 'hello', null, {}],
|
['1', 'hello', null, {}],
|
||||||
['1', '--hello', null, {member: membersFor1[0], message: 'hello'}],
|
['1', '--hello', null, {member: membersFor1[0], message: 'hello', hasAttachment: false}],
|
||||||
['1', 'hello', attachmentUrl, {}],
|
['1', 'hello', attachmentUrl, {}],
|
||||||
['1', '--hello', attachmentUrl, {member: membersFor1[0], message: 'hello', hasAttachment: true}],
|
['1', '--hello', attachmentUrl, {member: membersFor1[0], message: 'hello', hasAttachment: true}],
|
||||||
['1', '--', attachmentUrl, {member: membersFor1[0], message: '', hasAttachment: true}],
|
['1', '--', attachmentUrl, {member: membersFor1[0], message: '', hasAttachment: true}],
|
||||||
['1', '?hello}', null, {member: membersFor1[3], message: 'hello'}],
|
['1', '?hello}', null, {member: membersFor1[3], message: 'hello', hasAttachment: false}],
|
||||||
['1', '{hello}', null, {member: membersFor1[4], message: 'hello'}],
|
['1', '{hello}', null, {member: membersFor1[4], message: 'hello', hasAttachment: false}],
|
||||||
['1', '⭐hello', null, {member: membersFor1[5], message: 'hello'}],
|
['1', '⭐hello', null, {member: membersFor1[5], message: 'hello', hasAttachment: false}],
|
||||||
['2', 'hello', null, undefined],
|
['2', 'hello', null, undefined],
|
||||||
['2', '--hello', null, undefined],
|
['2', '--hello', null, undefined],
|
||||||
['2', 'hello', attachmentUrl, undefined],
|
['2', 'hello', attachmentUrl, undefined],
|
||||||
|
|||||||
Reference in New Issue
Block a user