adding import tests

This commit is contained in:
Aster Fialla
2026-02-23 13:36:31 -05:00
parent 813e893afb
commit daf23b2f5d
4 changed files with 99 additions and 7650 deletions

View File

@@ -8,11 +8,11 @@ const ih = {};
*
* @async
* @param {string} authorId - The author of the message
* @param {string} attachmentUrl - The attached JSON url.
* @param {string | null} attachmentUrl - The attached JSON url.
* @returns {string} A successful addition of all members.
* @throws {Error} When the member exists, or creating a member doesn't work.
*/
ih.pluralKitImport = async function (authorId, attachmentUrl) {
ih.pluralKitImport = async function (authorId, attachmentUrl= null) {
if (!attachmentUrl) {
throw new Error(enums.err.NOT_JSON_FILE);
}
@@ -32,9 +32,9 @@ ih.pluralKitImport = async function (authorId, attachmentUrl) {
errors.push(e.message);
});
}
const aggregatedText = addedMembers.length > 0 ? `Successfully added members: ${addedMembers.join(', ')}` : enums.err.NO_MEMBERS_IMPORTED;
const aggregatedText = addedMembers.length > 0 ? `Successfully added members: ${addedMembers.join(', ')}` : `${enums.err.NO_MEMBERS_IMPORTED}`;
if (errors.length > 0) {
throw new AggregateError(errors, aggregatedText);
throw new AggregateError(errors, `${aggregatedText}\n\n${enums.err.IMPORT_ERROR}`);
}
return aggregatedText;
});