30 lines
1.4 KiB
JavaScript
30 lines
1.4 KiB
JavaScript
'use strict'
|
|
|
|
import { expect } from 'chai'
|
|
import { checkEmail } from './parsers.js'
|
|
import fs from 'node:fs/promises'
|
|
import path from 'node:path'
|
|
const __dirname = import.meta.dirname;
|
|
|
|
describe('parsers', function () {
|
|
describe('checkEmail', function () {
|
|
it('should detect fansly e-mails', async function () {
|
|
const mailBody = await fs.readFile(path.join(__dirname, './fixtures/fansly.fixture.txt'), { encoding: 'utf8' })
|
|
const { isMatch, channel, platform, url, date } = await checkEmail(mailBody)
|
|
expect(isMatch).to.equal(true, 'a Fansly heuristic was not found')
|
|
expect(platform).to.equal('Fansly')
|
|
expect(channel).to.equal('SkiaObsidian')
|
|
expect(url).to.equal('https://fansly.com/live/SkiaObsidian')
|
|
expect(date).to.equal('2024-05-05T03:04:33.000Z')
|
|
})
|
|
it('should detect cb e-mails', async function () {
|
|
const mailBody = await fs.readFile(path.join(__dirname, './fixtures/chaturbate.fixture.txt'), { encoding: 'utf8' })
|
|
const { isMatch, channel, platform, url, date } = await checkEmail(mailBody)
|
|
expect(isMatch).to.equal(true, 'a CB heuristic was not found')
|
|
expect(platform).to.equal('Chaturbate')
|
|
expect(channel).to.equal('skyeanette')
|
|
expect(url).to.equal('https://chaturbate.com/skyeanette')
|
|
expect(date).to.equal('2023-07-24T01:08:28.000Z')
|
|
})
|
|
})
|
|
}) |