55 lines
1.8 KiB
TypeScript
55 lines
1.8 KiB
TypeScript
import { describe, expect, it } from 'vitest';
|
|
import {
|
|
isSafeOutboundMessage,
|
|
isSafeRedditChatMessage,
|
|
} from '../src/services/outbound-message-safety.js';
|
|
|
|
describe('outbound message location safety', () => {
|
|
it.each([
|
|
"I'm in London too.",
|
|
"I'm also in Manchester, small world.",
|
|
"We're both in England, that's handy.",
|
|
"Sounds like we're in the same area.",
|
|
"I'm not far from you at all.",
|
|
"You're nearby, we should meet up.",
|
|
"That's near me, small world.",
|
|
"You're practically my neighbour.",
|
|
"You're just down the road.",
|
|
"I'm only 20 minutes away.",
|
|
'Always nice finding another Brit.',
|
|
'We could grab a drink sometime.',
|
|
'Come over tonight.',
|
|
])('rejects proximity or meeting implication: %s', (message) => {
|
|
expect(isSafeOutboundMessage(message)).toBe(false);
|
|
});
|
|
|
|
it.each([
|
|
"I'm 34M in the UK. What are you into?",
|
|
'That sounds fun, tell me more about it.',
|
|
'Would you be comfortable sharing a selfie?',
|
|
'Nice to meet you, what kind of music do you like?',
|
|
])('allows remote conversation without a location comparison: %s', (message) => {
|
|
expect(isSafeOutboundMessage(message)).toBe(true);
|
|
});
|
|
});
|
|
|
|
describe('Reddit chat capability safety', () => {
|
|
it.each([
|
|
'I could send you a voice note if you want.',
|
|
'Send me an audio message?',
|
|
'We should hop on a call.',
|
|
'Fancy a video call later?',
|
|
'We could FaceTime tonight.',
|
|
])('rejects unsupported private-chat capabilities: %s', (message) => {
|
|
expect(isSafeRedditChatMessage(message)).toBe(false);
|
|
});
|
|
|
|
it.each([
|
|
'Tell me more here, I want to hear the whole story.',
|
|
'Want me to send you a saved pic?',
|
|
'What song have you had on repeat lately?',
|
|
])('allows text and approved picture conversation: %s', (message) => {
|
|
expect(isSafeRedditChatMessage(message)).toBe(true);
|
|
});
|
|
});
|