test: migration from Python to JavaScript

This commit is contained in:
Francis Lachapelle
2021-11-09 22:35:05 -05:00
parent c860bf4f58
commit 8d294467ef
2 changed files with 9 additions and 4 deletions

View File

@@ -82,7 +82,7 @@ describe('Sieve', function() {
it('enable vacation script - ignore lists', async function() {
const vacationMsg = 'vacation test - ignore list'
const daysInterval = 3
const mailaddr = user.email
const mailaddr = user.email.replace(/mailto:/, '')
const sieveVacationIgnoreLists = `require ["vacation"];\r\nif allof ( not exists ["list-help", "list-unsubscribe", "list-subscribe", "list-owner", "list-post", "list-archive", "list-id", "Mailing-List"], not header :comparator "i;ascii-casemap" :is "Precedence" ["list", "bulk", "junk"], not header :comparator "i;ascii-casemap" :matches "To" "Multiple recipients of*" ) { vacation :days ${daysInterval} :addresses ["${mailaddr}"] text:\r\n${vacationMsg}\r\n.\r\n;\r\n}\r\n`
let vacation
@@ -90,7 +90,7 @@ describe('Sieve', function() {
vacation.enabled = 1
await prefs.setNoSave('autoReplyText', vacationMsg)
await prefs.setNoSave('daysBetweenResponse', daysInterval)
await prefs.setNoSave('autoReplyEmailAddresses', [user.email])
await prefs.setNoSave('autoReplyEmailAddresses', [mailaddr])
await prefs.setNoSave('ignoreLists', 1)
await prefs.save()

View File

@@ -6,10 +6,15 @@ const path = require('path')
const { execSync } = require('child_process')
describe('sogo-tool tests', function() {
let tmpdir
let tmpdir, userdir
beforeAll(function() {
const { homedir } = os.userInfo()
userdir = homedir
})
beforeEach(function() {
tmpdir = mkdtempSync(path.join(os.tmpdir(), 'sogo-'))
tmpdir = mkdtempSync(path.join(homedir, 'sogo-'))
})
afterEach(function() {