30 lines
874 B
JavaScript
30 lines
874 B
JavaScript
import test from "node:test";
|
|
import assert from "node:assert/strict";
|
|
import * as mfm from "mfm-js";
|
|
import { extractMentions } from "./extract-mentions.js";
|
|
test("extractMentions keeps regular mentions", ()=>{
|
|
const mentions = extractMentions(mfm.parse("hello @alice and @bob@example.com"));
|
|
assert.deepEqual(mentions, [
|
|
{
|
|
username: "alice",
|
|
host: null,
|
|
acct: "@alice"
|
|
},
|
|
{
|
|
username: "bob",
|
|
host: "example.com",
|
|
acct: "@bob@example.com"
|
|
}
|
|
]);
|
|
});
|
|
test("extractMentions ignores user icon syntax", ()=>{
|
|
const mentions = extractMentions(mfm.parse("regular @alice icon :@alice: remote :@bob@example.com:"));
|
|
assert.deepEqual(mentions, [
|
|
{
|
|
username: "alice",
|
|
host: null,
|
|
acct: "@alice"
|
|
}
|
|
]);
|
|
});
|