Skip to content

Split things out for more testability#59

Merged
Cellivar merged 5 commits intomainfrom
feature/more-tests-yay
Dec 31, 2024
Merged

Split things out for more testability#59
Cellivar merged 5 commits intomainfrom
feature/more-tests-yay

Conversation

@Cellivar
Copy link
Owner

With the previous changes in place it's easier to make more of these functions pure and break them out into separate modules. Writing more tests against the smaller functions will be easier now.

This also moves the initial message handling function down to the base CommandSet class, with a delegate being registered in the child language classes. We also expose the current config to the message handling delegate as there are some EPL messages that may benefit from the added context.

@github-actions
Copy link

Coverage Report

Status Category Percentage Covered / Total
🔵 Lines 61.73% 2797 / 4531
🔵 Statements 61.73% 2797 / 4531
🔵 Functions 48.84% 191 / 391
🔵 Branches 75.46% 492 / 652
File Coverage
File Stmts Branches Functions Lines Uncovered Lines
Changed Files
src/Printer.ts 0.61% 0% 0% 0.61% 15-29, 37-446
src/Commands/CommandSet.ts 54.92% 95% 68.42% 54.92% 130-131, 137-147, 166-167, 170-189, 192-209, 216-217, 220-232
src/Commands/Messages.ts 56.97% 82.35% 53.33% 56.97% 38-39, 42-43, 53-54, 56-57, 64-67, 76-77, 89-90, 223-228, 231-295
src/Configs/ConfigurationTypes.ts 94.11% 63.63% 71.42% 94.11% 185-186, 190-192, 206
src/Languages/Epl/BasicCommands.ts 25.35% 50% 18.75% 25.35% 6-16, 19-23, 26-32, 35-43, 46-58, 61-69, 72-77, 80-87, 90-101, 104-115, 118-167, 170-232, 276-277, 285-295
src/Languages/Epl/CmdConfigurationInquiry.ts 85.27% 73.03% 100% 85.27% 72-80, 196-201, 249-258, 367-368, 370-371, 373-374, 376-377, 382-383, 385-386, 390-391, 433-438
src/Languages/Epl/EplPrinterCommandSet.ts 92.72% 100% 35.48% 92.72% 89-91, 97-99, 105-107, 129-131
src/Languages/Epl/Messages.ts 86% 57.14% 100% 86% 76-83
src/Languages/Zpl/BasicCommands.ts 40% 44.44% 23.52% 40% 16-46, 49-51, 54-64, 67-75, 78-87, 90-98, 101-103, 106-109, 112-120, 123-128, 131-134, 137-140, 169-179, 197-198
src/Languages/Zpl/Config.ts 4.16% 0% 0% 4.16% 39-92
src/Languages/Zpl/Messages.ts 3.38% 100% 0% 3.38% 5-107
src/Languages/Zpl/ZplPrinterCommandSet.ts 93.97% 100% 35.48% 93.97% 73-77, 131-133, 199-200
Generated in workflow #145 for commit c0ba034 by the Vitest Coverage Report Action

@Cellivar
Copy link
Owner Author

One PR that doesn't add a bajillion lines finally..

@Cellivar Cellivar merged commit 9eacb9d into main Dec 31, 2024
1 check passed
@Cellivar Cellivar deleted the feature/more-tests-yay branch December 31, 2024 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant