Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Some unit tests (coverage +5%) #285

Merged
merged 4 commits into from
Mar 21, 2025
Merged

Some unit tests (coverage +5%) #285

merged 4 commits into from
Mar 21, 2025

Conversation

alexcasalboni
Copy link
Contributor

Description of Changes

I've added some quick tests to start improving overall coverage (GitHub Copilot helped a bit 😄 ).

Before (35.38%):

Filename                                                Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
api-client/src/auth.rs                                       54                54     0.00%           8                 8     0.00%          87                87     0.00%           0                 0         -
api-client/src/lib.rs                                        16                16     0.00%           9                 9     0.00%          49                49     0.00%           0                 0         -
api-client/src/upload.rs                                     17                17     0.00%           2                 2     0.00%          13                13     0.00%           0                 0         -
cli/src/commands/auth/login.rs                               31                31     0.00%           2                 2     0.00%          48                48     0.00%           0                 0         -
cli/src/commands/auth/mod.rs                                  3                 3     0.00%           2                 2     0.00%           5                 5     0.00%           0                 0         -
cli/src/commands/auth/whoami.rs                              29                29     0.00%           2                 2     0.00%          28                28     0.00%           0                 0         -
cli/src/commands/completion.rs                                7                 7     0.00%           2                 2     0.00%          11                11     0.00%           0                 0         -
cli/src/commands/components/build.rs                         32                32     0.00%           5                 5     0.00%          22                22     0.00%           0                 0         -
cli/src/commands/components/check.rs                         43                43     0.00%           5                 5     0.00%          60                60     0.00%           0                 0         -
cli/src/commands/components/init.rs                          37                37     0.00%           2                 2     0.00%          60                60     0.00%           0                 0         -
cli/src/commands/components/list.rs                           4                 4     0.00%           2                 2     0.00%           5                 5     0.00%           0                 0         -
cli/src/commands/components/mod.rs                            3                 3     0.00%           2                 2     0.00%           5                 5     0.00%           0                 0         -
cli/src/commands/components/new.rs                           69                69     0.00%           6                 6     0.00%          79                79     0.00%           0                 0         -
cli/src/commands/components/pull.rs                           4                 4     0.00%           2                 2     0.00%           5                 5     0.00%           0                 0         -
cli/src/commands/components/push.rs                         236               236     0.00%          20                20     0.00%         370               370     0.00%           0                 0         -
cli/src/commands/components/test.rs                         206               206     0.00%          16                16     0.00%         260               260     0.00%           0                 0         -
cli/src/commands/macros.rs                                    7                 7     0.00%           4                 4     0.00%           7                 7     0.00%           0                 0         -
cli/src/commands/serve.rs                                    16                16     0.00%           3                 3     0.00%          17                17     0.00%           0                 0         -
cli/src/components/boilerplate.rs                             3                 3     0.00%           3                 3     0.00%           9                 9     0.00%           0                 0         -
cli/src/components/manifest.rs                               44                44     0.00%           9                 9     0.00%          53                53     0.00%           0                 0         -
cli/src/components/wit.rs                                    66                66     0.00%          12                12     0.00%         108               108     0.00%           0                 0         -
cli/src/config.rs                                            31                31     0.00%           7                 7     0.00%          44                44     0.00%           0                 0         -
cli/src/logger.rs                                            24                24     0.00%           7                 7     0.00%          54                54     0.00%           0                 0         -
cli/src/main.rs                                               2                 2     0.00%           2                 2     0.00%           7                 7     0.00%           0                 0         -
components-runtime/src/config.rs                              2                 2     0.00%           2                 2     0.00%          15                15     0.00%           0                 0         -
components-runtime/src/consent_mapping/mod.rs                 2                 2     0.00%           2                 2     0.00%           6                 6     0.00%           0                 0         -
components-runtime/src/context.rs                            91                77    15.38%          17                16     5.88%         136               106    22.06%           0                 0         -
components-runtime/src/data_collection/context.rs            31                31     0.00%          14                14     0.00%          98                98     0.00%           0                 0         -
components-runtime/src/data_collection/convert.rs            74                74     0.00%          17                17     0.00%         171               171     0.00%           0                 0         -
components-runtime/src/data_collection/debug.rs             101               101     0.00%          12                12     0.00%         226               226     0.00%           0                 0         -
components-runtime/src/data_collection/logger.rs             13                13     0.00%           1                 1     0.00%          31                31     0.00%           0                 0         -
components-runtime/src/data_collection/mod.rs               199               166    16.58%          14                11    21.43%         382               320    16.23%           0                 0         -
components-runtime/src/data_collection/payload.rs            40                40     0.00%           5                 5     0.00%          60                60     0.00%           0                 0         -
server/src/config.rs                                         40                 8    80.00%          15                 2    86.67%         113                11    90.27%           0                 0         -
server/src/lib.rs                                           115                65    43.48%          24                10    58.33%         144                64    55.56%           0                 0         -
server/src/monitor.rs                                        34                34     0.00%           4                 4     0.00%          48                48     0.00%           0                 0         -
server/src/proxy/compute/data_collection/mod.rs             246               127    48.37%          40                20    50.00%         956               433    54.71%           0                 0         -
server/src/proxy/compute/data_collection/payload.rs         148                32    78.38%          18                 0   100.00%         239                17    92.89%           0                 0         -
server/src/proxy/compute/html.rs                            156                17    89.10%          19                 0   100.00%         263                 4    98.48%           0                 0         -
server/src/proxy/compute/mod.rs                              67                18    73.13%          17                 3    82.35%         244                32    86.89%           0                 0         -
server/src/proxy/context/body.rs                             57                57     0.00%          18                18     0.00%          68                68     0.00%           0                 0         -
server/src/proxy/context/incoming.rs                         45                33    26.67%          23                13    43.48%         119                64    46.22%           0                 0         -
server/src/proxy/context/proxy.rs                            67                67     0.00%           5                 5     0.00%         118               118     0.00%           0                 0         -
server/src/proxy/context/redirection.rs                      13                13     0.00%           3                 3     0.00%          21                21     0.00%           0                 0         -
server/src/proxy/context/routing.rs                          55                55     0.00%           6                 6     0.00%          65                65     0.00%           0                 0         -
server/src/proxy/controller.rs                               86                86     0.00%          12                12     0.00%         215               215     0.00%           0                 0         -
server/src/proxy/mod.rs                                     133               132     0.75%          10                 9    10.00%         308               302     1.95%           0                 0         -
server/src/tools/cacheable.rs                                98                 0   100.00%          30                 0   100.00%         199                 0   100.00%           0                 0         -
server/src/tools/crypto.rs                                   27                 0   100.00%           7                 0   100.00%          58                 0   100.00%           0                 0         -
server/src/tools/edgee_cookie.rs                            155                59    61.94%          31                 7    77.42%         306               100    67.32%           0                 0         -
server/src/tools/real_ip.rs                                  80                 0   100.00%          24                 0   100.00%         177                 0   100.00%           0                 0         -
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                                      3159              2293    27.41%         524               326    37.79%        6192              4001    35.38%           0                 0         -

After (40.82%):

Filename                                                Regions    Missed Regions     Cover   Functions  Missed Functions  Executed       Lines      Missed Lines     Cover    Branches   Missed Branches     Cover
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
api-client/src/auth.rs                                       54                54     0.00%           8                 8     0.00%          87                87     0.00%           0                 0         -
api-client/src/lib.rs                                        16                16     0.00%           9                 9     0.00%          49                49     0.00%           0                 0         -
api-client/src/upload.rs                                     17                17     0.00%           2                 2     0.00%          13                13     0.00%           0                 0         -
cli/src/commands/auth/login.rs                               31                31     0.00%           2                 2     0.00%          48                48     0.00%           0                 0         -
cli/src/commands/auth/mod.rs                                  3                 3     0.00%           2                 2     0.00%           5                 5     0.00%           0                 0         -
cli/src/commands/auth/whoami.rs                              29                29     0.00%           2                 2     0.00%          28                28     0.00%           0                 0         -
cli/src/commands/completion.rs                                7                 7     0.00%           2                 2     0.00%          11                11     0.00%           0                 0         -
cli/src/commands/components/build.rs                         32                32     0.00%           5                 5     0.00%          22                22     0.00%           0                 0         -
cli/src/commands/components/check.rs                         43                43     0.00%           5                 5     0.00%          60                60     0.00%           0                 0         -
cli/src/commands/components/init.rs                          37                37     0.00%           2                 2     0.00%          60                60     0.00%           0                 0         -
cli/src/commands/components/list.rs                           4                 4     0.00%           2                 2     0.00%           5                 5     0.00%           0                 0         -
cli/src/commands/components/mod.rs                            3                 3     0.00%           2                 2     0.00%           5                 5     0.00%           0                 0         -
cli/src/commands/components/new.rs                           69                69     0.00%           6                 6     0.00%          79                79     0.00%           0                 0         -
cli/src/commands/components/pull.rs                           4                 4     0.00%           2                 2     0.00%           5                 5     0.00%           0                 0         -
cli/src/commands/components/push.rs                         236               236     0.00%          20                20     0.00%         370               370     0.00%           0                 0         -
cli/src/commands/components/test.rs                         206               206     0.00%          16                16     0.00%         260               260     0.00%           0                 0         -
cli/src/commands/macros.rs                                    7                 7     0.00%           4                 4     0.00%           7                 7     0.00%           0                 0         -
cli/src/commands/serve.rs                                    16                16     0.00%           3                 3     0.00%          17                17     0.00%           0                 0         -
cli/src/components/boilerplate.rs                            31                 0   100.00%          12                 0   100.00%          54                 0   100.00%           0                 0         -
cli/src/components/manifest.rs                               69                 5    92.75%          20                 3    85.00%         260                 3    98.85%           0                 0         -
cli/src/components/wit.rs                                    66                66     0.00%          12                12     0.00%         108               108     0.00%           0                 0         -
cli/src/config.rs                                            50                 1    98.00%          20                 0   100.00%         178                 0   100.00%           0                 0         -
cli/src/logger.rs                                            24                24     0.00%           7                 7     0.00%          54                54     0.00%           0                 0         -
cli/src/main.rs                                               2                 2     0.00%           2                 2     0.00%           7                 7     0.00%           0                 0         -
components-runtime/src/config.rs                              2                 2     0.00%           2                 2     0.00%          15                15     0.00%           0                 0         -
components-runtime/src/consent_mapping/mod.rs                 2                 2     0.00%           2                 2     0.00%           6                 6     0.00%           0                 0         -
components-runtime/src/context.rs                            91                77    15.38%          17                16     5.88%         136               106    22.06%           0                 0         -
components-runtime/src/data_collection/context.rs            31                31     0.00%          14                14     0.00%          98                98     0.00%           0                 0         -
components-runtime/src/data_collection/convert.rs            74                74     0.00%          17                17     0.00%         171               171     0.00%           0                 0         -
components-runtime/src/data_collection/debug.rs             101               101     0.00%          12                12     0.00%         226               226     0.00%           0                 0         -
components-runtime/src/data_collection/logger.rs             13                13     0.00%           1                 1     0.00%          31                31     0.00%           0                 0         -
components-runtime/src/data_collection/mod.rs               199               166    16.58%          14                11    21.43%         382               320    16.23%           0                 0         -
components-runtime/src/data_collection/payload.rs            40                40     0.00%           5                 5     0.00%          60                60     0.00%           0                 0         -
server/src/config.rs                                         40                 7    82.50%          15                 1    93.33%         113                 6    94.69%           0                 0         -
server/src/lib.rs                                           115                65    43.48%          24                10    58.33%         144                64    55.56%           0                 0         -
server/src/monitor.rs                                        34                34     0.00%           4                 4     0.00%          48                48     0.00%           0                 0         -
server/src/proxy/compute/data_collection/mod.rs             246               127    48.37%          40                20    50.00%         956               433    54.71%           0                 0         -
server/src/proxy/compute/data_collection/payload.rs         148                32    78.38%          18                 0   100.00%         239                17    92.89%           0                 0         -
server/src/proxy/compute/html.rs                            156                17    89.10%          19                 0   100.00%         263                 4    98.48%           0                 0         -
server/src/proxy/compute/mod.rs                              67                18    73.13%          17                 3    82.35%         244                32    86.89%           0                 0         -
server/src/proxy/context/body.rs                             57                57     0.00%          18                18     0.00%          68                68     0.00%           0                 0         -
server/src/proxy/context/incoming.rs                         45                33    26.67%          23                13    43.48%         119                64    46.22%           0                 0         -
server/src/proxy/context/proxy.rs                            67                67     0.00%           5                 5     0.00%         118               118     0.00%           0                 0         -
server/src/proxy/context/redirection.rs                      13                13     0.00%           3                 3     0.00%          21                21     0.00%           0                 0         -
server/src/proxy/context/routing.rs                          55                55     0.00%           6                 6     0.00%          65                65     0.00%           0                 0         -
server/src/proxy/controller.rs                               86                86     0.00%          12                12     0.00%         215               215     0.00%           0                 0         -
server/src/proxy/mod.rs                                     133               132     0.75%          10                 9    10.00%         308               302     1.95%           0                 0         -
server/src/tools/cacheable.rs                                98                 0   100.00%          30                 0   100.00%         199                 0   100.00%           0                 0         -
server/src/tools/crypto.rs                                   27                 0   100.00%           7                 0   100.00%          58                 0   100.00%           0                 0         -
server/src/tools/edgee_cookie.rs                            155                59    61.94%          31                 7    77.42%         306               100    67.32%           0                 0         -
server/src/tools/real_ip.rs                                  80                 0   100.00%          24                 0   100.00%         177                 0   100.00%           0                 0         -
-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------
TOTAL                                                      3231              2220    31.29%         557               309    44.52%        6578              3893    40.82%           0                 0         -

@coveralls
Copy link

Pull Request Test Coverage Report for Build 13943237858

Details

  • 418 of 418 (100.0%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+5.8%) to 41.153%

Totals Coverage Status
Change from base Build 13921317934: 5.8%
Covered Lines: 2605
Relevant Lines: 6330

💛 - Coveralls

@alexcasalboni alexcasalboni merged commit 581c4bb into main Mar 21, 2025
6 checks passed
@alexcasalboni alexcasalboni deleted the some-unit-tests branch March 21, 2025 11:03
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.

3 participants