Fix EOL in streaming tests

This commit is contained in:
larabr 2020-12-22 14:26:03 +01:00 committed by Daniel Huigens
parent 286d991265
commit 89f738da45

View File

@ -400,7 +400,7 @@ function tests() {
const message = await openpgp.readArmoredMessage(openpgp.stream.transform(encrypted, value => {
value += '';
if (value === '=' || value.length === 6) return; // Remove checksum
const newlineIndex = value.indexOf('\r\n', 500);
const newlineIndex = value.indexOf('\n', 500);
if (value.length > 1000) return value.slice(0, newlineIndex - 1) + (value[newlineIndex - 1] === 'a' ? 'b' : 'a') + value.slice(newlineIndex);
return value;
}));
@ -435,7 +435,7 @@ function tests() {
const message = await openpgp.readArmoredMessage(openpgp.stream.transform(encrypted, value => {
value += '';
const newlineIndex = value.indexOf('\r\n', 500);
const newlineIndex = value.indexOf('\n', 500);
if (value.length > 1000) return value.slice(0, newlineIndex - 1) + (value[newlineIndex - 1] === 'a' ? 'b' : 'a') + value.slice(newlineIndex);
return value;
}));
@ -470,7 +470,7 @@ function tests() {
const message = await openpgp.readArmoredMessage(openpgp.stream.transform(encrypted, value => {
value += '';
const newlineIndex = value.indexOf('\r\n', 500);
const newlineIndex = value.indexOf('\n', 500);
if (value.length > 1000) return value.slice(0, newlineIndex - 1) + (value[newlineIndex - 1] === 'a' ? 'b' : 'a') + value.slice(newlineIndex);
return value;
}));
@ -501,7 +501,7 @@ function tests() {
const message = await openpgp.readArmoredMessage(openpgp.stream.transform(signed, value => {
value += '';
const newlineIndex = value.indexOf('\r\n', 500);
const newlineIndex = value.indexOf('\n', 500);
if (value.length > 1000) return value.slice(0, newlineIndex - 1) + (value[newlineIndex - 1] === 'a' ? 'b' : 'a') + value.slice(newlineIndex);
return value;
}));