Fix tests for args setting in Pleroma.Upload.Filter.Mogrify

This commit is contained in:
Angelina Filippova 2020-08-04 00:57:17 +03:00
parent 8e1825ae1a
commit 3b4abed18b
2 changed files with 4 additions and 6 deletions

View file

@ -269,8 +269,6 @@ describe('Parse tuples', () => {
const expectedSenderTuple = { ':sender': { email: 'test@email.com', nickname: 'test' }}
const expectedSenderString = { ':sender': { email: 'test@email.com' }}
console.log(parseTuples(senderEmpty, ':welcome'))
expect(_.isEqual(expectedSenderEmpty, parseTuples(senderEmpty, ':welcome'))).toBeTruthy()
expect(_.isEqual(expectedSenderTuple, parseTuples(senderTuple, ':welcome'))).toBeTruthy()
expect(_.isEqual(expectedSenderString, parseTuples(senderString, ':welcome'))).toBeTruthy()
@ -291,8 +289,8 @@ describe('Parse tuples', () => {
})
it('parses args setting in Pleroma.Upload.Filter.Mogrify', () => {
const tuples = [{ tuple: [':args', ['strip', { tuple: ['implode', '1'] }]]}]
const expectedResult = { ':args': ['strip', 'implode'] }
const tuples = [{ tuple: [':args', ['strip', '{ "implode", "1" }']]}]
const expectedResult = { ':args': ['strip', '{ "implode", "1" }'] }
const result = parseTuples(tuples, 'Pleroma.Upload.Filter.Mogrify')
expect(_.isEqual(expectedResult, result)).toBeTruthy()

View file

@ -357,14 +357,14 @@ describe('Wrap settings', () => {
it('wraps args setting in Pleroma.Upload.Filter.Mogrify group', () => {
const settings = { 'Pleroma.Upload.Filter.Mogrify': { ':args': [
['string', ['list', 'string'], ['list', 'tuple']],
['strip', 'implode']
['strip', '{ "implode", "1"]}']
]}}
const state = { ':pleroma': { 'Pleroma.Upload.Filter.Mogrify': {}}}
const result = wrapUpdatedSettings(':pleroma', settings, state)
const expectedResult = [{
group: ':pleroma',
key: 'Pleroma.Upload.Filter.Mogrify',
value: [{tuple: [':args', ['strip', {tuple: ['implode', '1']}]]}]
value: [{tuple: [':args', ['strip', '{ "implode", "1"]}']]}]
}]
expect(_.isEqual(result, expectedResult)).toBeTruthy()