Commit Graph

70 Commits

Author SHA1 Message Date
Aster Fialla
5ef9050a7d separate member repo from member helper 2026-03-01 14:46:39 -05:00
Aster Fialla
71d117b7c6 delete unneeded database.js 2026-03-01 12:52:34 -05:00
d14e89e8b2 Fix: Further converting ES6 to CJS - Making exports named instead of default (#26)
* adding to git ignore

* making imports named not default to not break all my tests

* adjusted setup for memberhelper test

---------

Co-authored-by: Aster Fialla <asterfialla@gmail.com>
2026-02-28 15:28:27 -05:00
39a7115803 Converting ES6 back to CJS (#25)
converting back to cjs

Co-authored-by: Aster Fialla <asterfialla@gmail.com>
2026-02-28 14:39:32 -05:00
df80eca0ec refactor: Removing then/catch from async/await calls (#22)
* refactored async/await for import helper to not also use then/catch

* added enum

* refactor webhookHelper and tests to not use then/catch

* changed docstring

* refactoring bot and tests to not use then/catch

* refactoring commands.js and tests to not use then/catch

* refactoring memberHelper.js and tests to not use then/catch

* removing then/catch from messageHelper.test.js

* fixed set up for commands tests

* edited bot to have top level main function

* one more test in commands.js, and removed console.error

* fixed typo in webhookHelper

* forgot to switch over some tests in bot.test and commands.test

* removed console.log from import helper

* put console.error in commands

* converted utils.js to not use then/catch

* tested utils checkImageFormatValidity

* removed jest-fetch-mock since it turns out I was just manually mocking it anyway

* refactored database to not use then/catch

* added dash to commands.js and test to pass

* added the remaining webhook tests

* changed utils to check for 10MB size not 1MB

* removed unnecessary try/catch from utils

* Simplify getWebhook to use .find() instead of foreach logic

* make memberCommand exit when error occurs with parseMemberCommand

* changed commands.js to not have user interaction within the catch

* updated console.error message in database.js

* made importHelper mock throw error instead of "resolve" error

* replaced "pk;" with "pf;" in test

* Got rid of unnecessary check for empty message from user (Fluxer doesn't allow this to happen)

Removed export of token

* getAllMembersInfo checks for fields.length

* added default case to memberCommandHandler to throw error if command is not recognized

* reversed check for valid proxy (was returning valid if the proxy existed and invalid if it didn't)

* pushes e.message instead of full error object to errors array in importHelper

* adjusted tests to properly use mockRejectedValue for async rejections

* changed getAllMembersInfo map to say `index` not `name` as it actually gets the index of a member and then the member object

* adjusted importHelper to properly test throwing of aggregate error

* revamped setting of expiration warning (moved to utils and changed logic, wrote tests)

---------

Co-authored-by: Aster Fialla <asterfialla@gmail.com>
2026-02-25 19:30:39 -05:00
7fead5e3d7 feat: Add unit tests (#21)
Tests are mostly complete (though some are failing -- to be fixed in the
async/await refactor.

Also refactored, fixed bugs found while testing, and added ability to
type `pf;m` instead of `pf;member`.

---------

Co-authored-by: Aster Fialla <asterfialla@gmail.com>
2026-02-24 12:42:23 -05:00
Aster Fialla
56d7f7d1fa call getMemberCommandInfo in parseMemberCommand 2026-02-20 11:33:16 -05:00
Aster Fialla
8f6ae668b0 update getMemberCommandInfo
# Conflicts:
#	src/helpers/memberHelper.js
2026-02-20 11:31:54 -05:00
Aster Fialla
211a705f31 update enums 2026-02-20 11:29:28 -05:00
8fc590c062 feat: add tests and other such features (#3)
* converted import syntax to ES modules

removed unused methods

* got test sort of working (jest set up is not crashing but also not mocking correctly)

* adjusted beforeeach/beforeall so more pass

* more correct test setup

* converted import syntax to commonJS

removed unused methods

* got test sort of working (jest set up is not crashing but also not mocking correctly)

* adjusted beforeeach/beforeall so more pass

* more correct test setup

* more correct dockerfile and compose.yaml

* Revert "converted import syntax to commonJS"

This reverts commit 5ab0d62b

* updated jest to sort of work with es6

* separating out enum return from method return

* mostly working except for the weirdest error

* nevermind it wasn't actually working, gonna move on for now

* added babel to convert es modules to cjs

* finally figured out issue with tests (referencing the method directly in the test.each calls the real method not the mock in beforeEach())

* setup fixed more

* added error handling parseMemberCommand test

* renamed db to database
more tests and fixing logic for memberhelper

* upgraded fluxer.js

* moved import to helpers folder

* moved import to helpers folder

* more tests for member helper

* think i fixed weird error with webhook sending error when a user has no members

* simplified sendMessageAsAttachment

* added return to addFullMember so that addNewMember can reference it properly in strings

* test setup for messagehelper and webhookhelper

* readded line i shouldn't have removed in sendMessageAsMember

* fixed test and logic

* added test for memberHelper

* updated sendMessageAsAttachment to returnBufferFromText and updated commands/webhookHelper accordingly

* added tests for parseProxyTags and updated logic

* added "return" so tests dont terminate on failure and deleted env.jest

* finished tests for messageHelper!

* more cases for messageHelper just in case

* updating docstring for messageHelper parseProxyTags

* more tests for webhookhelper

* deleted extra file added during merge

* removed confusing brackets from enum docs

* finally mocking correctly

* adding more cases to messageHelper tests

* updating enums

* removed error response when proxy is sent without content

* , updated tests for webhookHelper and removed error response when proxy is sent without content

* added debounce to count guilds properly

* added todo note

* added tests for updateDisplayName

* edited help message trigger for updatePropic

* update message helper test to include space case

* update bot to suppress errors from API

* fixed bug for import not sending help text, added help text if you type a unrecognized command

* updated to be enum

* updated member helper and tests

* edit enums, tweak import content command

* removed unnecessary await and console.log

* made it easier to make a member

* added nicer error listing to importHelper

* updated documentation

* Merge branch 'main' of https://github.com/pieartsy/PluralFlux into add-tests

---------

Co-authored-by: Aster Fialla <asterfialla@gmail.com>
2026-02-19 21:45:10 -05:00
Aster Fialla
055ecdf20d removed unneeded code 2026-02-16 13:43:34 -05:00
Aster Fialla
51ada567ce made bot search and query lowercase instead of only applying to uppercase 2026-02-16 13:30:57 -05:00
Aster Fialla
be5505b03c added --help functionality to import command 2026-02-16 13:15:28 -05:00
Aster Fialla
07d4e735eb changed parseProxyTags to filter proxy differently. changed conditional in sendMessageAsMember because obj will never not exist 2026-02-16 12:48:26 -05:00
Aster Fialla
8b709b75ce updated readme and enums 2026-02-16 12:31:44 -05:00
Aster Fialla
6cd34e9c68 adjusted webhook helper to not query twice for member.
adjusted proxy message to just reply to message w/ attachments with "Attachment sent by" instead of sending error message
2026-02-16 12:30:46 -05:00
Aster Fialla
b2fc9f9111 fixed regex to escape proxy tags that match a normal regex 2026-02-16 12:16:06 -05:00
Aster Fialla
b3813d771d tentative adding of system model (not used yet) 2026-02-16 11:09:03 -05:00
Aster Fialla
b15262e1c5 added .env to bot.js and db.js 2026-02-16 11:08:19 -05:00
Aster Fialla
4ea0a777af actually fixed proxy query 2026-02-16 10:56:40 -05:00
Aster Fialla
559da55176 edited addFullMember to throw error if member was not added successfully 2026-02-16 10:36:31 -05:00
Aster Fialla
f169f4d755 adjusted reference to wrong file with import and enums 2026-02-16 10:32:14 -05:00
Aster Fialla
32adf7b6ef move list --help check to parseMemberCommand 2026-02-16 09:34:07 -05:00
Aster Fialla
1db4ab37dc removed nonexistent e 2026-02-16 00:42:15 -05:00
Aster Fialla
fa0de17724 edited member helper to notify only 25 members are supported currently in list 2026-02-16 00:40:40 -05:00
Aster Fialla
0a7057ef63 list enum documentation 2026-02-16 00:23:56 -05:00
Aster Fialla
58912f382c edited remove to not "remove" nonexistent members 2026-02-16 00:22:55 -05:00
Aster Fialla
375601cca7 added --help to list 2026-02-16 00:21:46 -05:00
Aster Fialla
e67a10fa79 allows invalid propic to still be imported 2026-02-16 00:16:38 -05:00
Aster Fialla
b83325785f removed ability to send attachments since i think fluxer deletes them from the server when a message is deleted :( 2026-02-16 00:11:57 -05:00
Aster Fialla
49cab523f0 removed ability to send attachments since i think fluxer deletes them from the server when a message is deleted :( 2026-02-16 00:11:11 -05:00
Aster Fialla
e1dbba9043 hopefully ACTUALLY writes and sends file now... 2026-02-15 23:18:29 -05:00
Aster Fialla
cf37508ee4 docstrings and changed expected parameters for messageHelper parseProxyTags 2026-02-15 21:25:07 -05:00
Aster Fialla
fe05b93ac7 adding webhook sending of attachment as an embed since sending image directly apparently doesn't work in fluxer yet 2026-02-15 21:24:19 -05:00
Aster Fialla
964b5ec32a actually writing to created file if import fails 2026-02-15 21:18:40 -05:00
Aster Fialla
cebf14a2f5 updated readme and docs 2026-02-15 16:52:08 -05:00
Aster Fialla
dafbafeec6 if parsing member command returns null, don't send anything. 2026-02-15 16:48:51 -05:00
Aster Fialla
8f70960079 removed some overzealous error handling 2026-02-15 16:48:22 -05:00
Aster Fialla
75dba413b8 turned off logging for sequelize since i don't gotta see all that 2026-02-15 16:21:00 -05:00
Aster Fialla
f81da5ac27 added handler to send string as an attachment if it's too long 2026-02-15 16:20:42 -05:00
Aster Fialla
be83e8d629 removed unnecessary console.logs 2026-02-15 15:57:28 -05:00
Aster Fialla
9bff32456c changed error handling to not return error when database returns null as sometimes we want that 2026-02-15 15:57:08 -05:00
Aster Fialla
ba623b0b78 removed unused status variable 2026-02-15 15:15:04 -05:00
Aster Fialla
85d876f660 removed gateway check since I probably do not need it 2026-02-15 15:05:08 -05:00
Aster Fialla
ff84a637b2 edited enum reference to ADD 2026-02-15 02:17:05 -05:00
Aster Fialla
8762e41a0a changed add command back to new because dang. 2026-02-15 02:12:59 -05:00
Aster Fialla
63594c9819 edited documentation and added README 2026-02-15 01:47:36 -05:00
Aster Fialla
fc7309630f edited enums description 2026-02-15 01:42:12 -05:00
Aster Fialla
5d80895918 got import messages working! 2026-02-15 01:29:56 -05:00
Aster Fialla
2e63532dc7 removed "cause" parameter for error 2026-02-15 01:17:06 -05:00