Skip to content

feat(ui-web): refactor the web backend, create tests #38

feat(ui-web): refactor the web backend, create tests

feat(ui-web): refactor the web backend, create tests #38

GitHub Actions / DotNET - Tests succeeded Sep 16, 2023 in 0s

144 passed, 0 failed and 0 skipped

Tests passed successfully

Report Passed Failed Skipped Time
tests/Serilog.Ui.ElasticSearchProvider.Tests/TestResults/test-results.trx 16✔️ 44s
tests/Serilog.Ui.MongoDbProvider.Tests/TestResults/test-results.trx 18✔️ 6s
tests/Serilog.Ui.MsSqlServerProvider.Tests/TestResults/test-results.trx 17✔️ 40s
tests/Serilog.Ui.MySqlProvider.Tests/TestResults/test-results.trx 16✔️ 42s
tests/Serilog.Ui.PostgreSqlProvider.Tests/TestResults/test-results.trx 31✔️ 21s
tests/Serilog.Ui.Web.Tests/TestResults/test-results.trx 46✔️ 3s

✔️ tests/Serilog.Ui.ElasticSearchProvider.Tests/TestResults/test-results.trx

16 tests were completed in 44s with 16 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
ElasticSearch.Tests.DataProvider.DataProviderBaseTest 2✔️ 181ms
ElasticSearch.Tests.DataProvider.DataProviderPaginationTest 4✔️ 41ms
ElasticSearch.Tests.DataProvider.DataProviderSearchTest 8✔️ 482ms
ElasticSearch.Tests.Extensions.SerilogUiOptionBuilderExtensionsTest 2✔️ 47ms

✔️ ElasticSearch.Tests.DataProvider.DataProviderBaseTest

✔️ It_logs_and_throws_when_db_read_breaks_down
✔️ It_throws_when_any_dependency_is_null

✔️ ElasticSearch.Tests.DataProvider.DataProviderPaginationTest

✔️ It fetches with limit
✔️ It fetches with limit and skip
✔️ It fetches with skip
✔️ It_throws_when_skip_is_zero

✔️ ElasticSearch.Tests.DataProvider.DataProviderSearchTest

✔️ It finds all data with default search
✔️ It finds data with all filters
✔️ It finds only data emitted after date
✔️ It finds only data emitted before date
✔️ It finds only data with specific level
✔️ It finds only data with specific message content
✔️ It finds same data on same repeated search
✔️ It_finds_only_data_emitted_in_dates_range

✔️ ElasticSearch.Tests.Extensions.SerilogUiOptionBuilderExtensionsTest

✔️ It_registers_provider_and_dependencies
✔️ It_throws_on_invalid_registration

✔️ tests/Serilog.Ui.MongoDbProvider.Tests/TestResults/test-results.trx

18 tests were completed in 6s with 18 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
MongoDb.Tests.DataProvider.DataProviderBaseTest 2✔️ 517ms
MongoDb.Tests.DataProvider.DataProviderPaginationTest 4✔️ 346ms
MongoDb.Tests.DataProvider.DataProviderSearchTest 8✔️ 366ms
MongoDb.Tests.Extensions.SerilogUiOptionBuilderExtensionsTest 4✔️ 739ms

✔️ MongoDb.Tests.DataProvider.DataProviderBaseTest

✔️ It logs and throws when db read breaks down
✔️ It throws when any dependency is null

✔️ MongoDb.Tests.DataProvider.DataProviderPaginationTest

✔️ It fetches with limit
✔️ It fetches with limit and skip
✔️ It fetches with skip
✔️ It throws when skip is zero

✔️ MongoDb.Tests.DataProvider.DataProviderSearchTest

✔️ It finds all data with default search
✔️ It finds data with all filters
✔️ It finds only data emitted after date
✔️ It finds only data emitted before date
✔️ It finds only data emitted in dates range
✔️ It finds only data with specific level
✔️ It finds only data with specific message content
✔️ It finds same data on same repeated search

✔️ MongoDb.Tests.Extensions.SerilogUiOptionBuilderExtensionsTest

✔️ It registers IMongoClient only when not registered
✔️ It registers provider and dependencies with connstring and collection
✔️ It registers provider and dependencies with connstring collection and dbname
✔️ It throws on invalid registration

✔️ tests/Serilog.Ui.MsSqlServerProvider.Tests/TestResults/test-results.trx

17 tests were completed in 40s with 17 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
MsSql.Tests.DataProvider.DataProviderBaseTest 2✔️ 97ms
MsSql.Tests.DataProvider.DataProviderPaginationTest 4✔️ 162ms
MsSql.Tests.DataProvider.DataProviderSearchTest 8✔️ 170ms
MsSql.Tests.Extensions.SerilogUiOptionBuilderExtensionsTest 3✔️ 217ms

✔️ MsSql.Tests.DataProvider.DataProviderBaseTest

✔️ It logs and throws when db read breaks down
✔️ It throws when any dependency is null

✔️ MsSql.Tests.DataProvider.DataProviderPaginationTest

✔️ It fetches with limit
✔️ It fetches with limit and skip
✔️ It fetches with skip
✔️ It throws when skip is zero

✔️ MsSql.Tests.DataProvider.DataProviderSearchTest

✔️ It finds all data with default search
✔️ It finds data with all filters
✔️ It finds only data emitted after date
✔️ It finds only data emitted before date
✔️ It finds only data emitted in dates range
✔️ It finds only data with specific level
✔️ It finds only data with specific message content
✔️ It finds same data on same repeated search

✔️ MsSql.Tests.Extensions.SerilogUiOptionBuilderExtensionsTest

✔️ It registers provider and dependencies(schemaName: "schema", expected: "schema")
✔️ It registers provider and dependencies(schemaName: null, expected: "dbo")
✔️ It throws on invalid registration

✔️ tests/Serilog.Ui.MySqlProvider.Tests/TestResults/test-results.trx

16 tests were completed in 42s with 16 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
MySql.Tests.DataProvider.DataProviderBaseTest 2✔️ 126ms
MySql.Tests.DataProvider.DataProviderPaginationTest 4✔️ 140ms
MySql.Tests.DataProvider.DataProviderSearchTest 8✔️ 159ms
MySql.Tests.Extensions.SerilogUiOptionBuilderExtensionsTest 2✔️ 109ms

✔️ MySql.Tests.DataProvider.DataProviderBaseTest

✔️ It logs and throws when db read breaks down
✔️ It throws when any dependency is null

✔️ MySql.Tests.DataProvider.DataProviderPaginationTest

✔️ It fetches with limit
✔️ It fetches with limit and skip
✔️ It fetches with skip
✔️ It throws when skip is zero

✔️ MySql.Tests.DataProvider.DataProviderSearchTest

✔️ It finds all data with default search
✔️ It finds data with all filters
✔️ It finds only data emitted after date
✔️ It finds only data emitted before date
✔️ It finds only data emitted in dates range
✔️ It finds only data with specific level
✔️ It finds only data with specific message content
✔️ It finds same data on same repeated search

✔️ MySql.Tests.Extensions.SerilogUiOptionBuilderExtensionsTest

✔️ It registers provider and dependencies
✔️ It throws on invalid registration

✔️ tests/Serilog.Ui.PostgreSqlProvider.Tests/TestResults/test-results.trx

31 tests were completed in 21s with 31 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
Postgres.Tests.DataProvider.DataProviderBaseTest 2✔️ 236ms
Postgres.Tests.DataProvider.DataProviderPaginationTest 4✔️ 175ms
Postgres.Tests.DataProvider.DataProviderSearchTest 8✔️ 234ms
Postgres.Tests.Extensions.SerilogUiOptionBuilderExtensionsTest 3✔️ 128ms
Postgres.Tests.Model.LogLevelConverterTest 14✔️ 7ms

✔️ Postgres.Tests.DataProvider.DataProviderBaseTest

✔️ It logs and throws when db read breaks down
✔️ It throws when any dependency is null

✔️ Postgres.Tests.DataProvider.DataProviderPaginationTest

✔️ It fetches with limit
✔️ It fetches with limit and skip
✔️ It fetches with skip
✔️ It throws when skip is zero

✔️ Postgres.Tests.DataProvider.DataProviderSearchTest

✔️ It finds all data with default search
✔️ It finds data with all filters
✔️ It finds only data emitted after date
✔️ It finds only data emitted before date
✔️ It finds only data emitted in dates range
✔️ It finds only data with specific level
✔️ It finds only data with specific message content
✔️ It finds same data on same repeated search

✔️ Postgres.Tests.Extensions.SerilogUiOptionBuilderExtensionsTest

✔️ It registers provider and dependencies(schemaName: "schema", expected: "schema")
✔️ It registers provider and dependencies(schemaName: null, expected: "public")
✔️ It throws on invalid registration

✔️ Postgres.Tests.Model.LogLevelConverterTest

✔️ It maps the correct log level name(input: "0", expected: "Verbose")
✔️ It maps the correct log level name(input: "1", expected: "Debug")
✔️ It maps the correct log level name(input: "2", expected: "Information")
✔️ It maps the correct log level name(input: "3", expected: "Warning")
✔️ It maps the correct log level name(input: "4", expected: "Error")
✔️ It maps the correct log level name(input: "5", expected: "Fatal")
✔️ It maps the correct log level name(input: "random", expected: "")
✔️ It maps the correct log level value(input: "Debug", expected: 1)
✔️ It maps the correct log level value(input: "Error", expected: 4)
✔️ It maps the correct log level value(input: "Fatal", expected: 5)
✔️ It maps the correct log level value(input: "Information", expected: 2)
✔️ It maps the correct log level value(input: "random", expected: 100)
✔️ It maps the correct log level value(input: "Verbose", expected: 0)
✔️ It maps the correct log level value(input: "Warning", expected: 3)

✔️ tests/Serilog.Ui.Web.Tests/TestResults/test-results.trx

46 tests were completed in 3s with 46 passed, 0 failed and 0 skipped.

Test suite Passed Failed Skipped Time
Serilog.Ui.Web.Tests.Authorization.AuthorizationAsyncTest 1✔️ 2s
Serilog.Ui.Web.Tests.Authorization.AuthorizationDefaultTest 1✔️ 128ms
Serilog.Ui.Web.Tests.Authorization.AuthorizationSyncTest 1✔️ 45ms
Ui.Web.Tests.Endpoints.SerilogUiAppRoutesTest 4✔️ 289ms
Ui.Web.Tests.Endpoints.SerilogUiDecoratorsTest 4✔️ 24ms
Ui.Web.Tests.Endpoints.SerilogUiEndpointsTest 4✔️ 177ms
Ui.Web.Tests.Extensions.ApplicationBuilderExtensionsTest 3✔️ 646ms
Ui.Web.Tests.Extensions.ContentInjectionTest 7✔️ 4ms
Ui.Web.Tests.Extensions.HttpRequestExtensionsTest 5✔️ 640ms
Ui.Web.Tests.SerilogUiMiddlewareTest 16✔️ 232ms

✔️ Serilog.Ui.Web.Tests.Authorization.AuthorizationAsyncTest

✔️ Local Requests Are Not Allowed By Async Filters

✔️ Serilog.Ui.Web.Tests.Authorization.AuthorizationDefaultTest

✔️ Local Requests Are Allowed By Default

✔️ Serilog.Ui.Web.Tests.Authorization.AuthorizationSyncTest

✔️ Local Requests Are Not Allowed By Sync Filters

✔️ Ui.Web.Tests.Endpoints.SerilogUiAppRoutesTest

✔️ It gets app home
✔️ It redirects app home
✔️ It returns page error when stream cannot load app home
✔️ It throws on app home if ui options were not set

✔️ Ui.Web.Tests.Endpoints.SerilogUiDecoratorsTest

✔️ It blocks the call on failed authentication
✔️ It blocks the GetHome on failed authentication with custom delegate
✔️ It forwards the call to app endpoints on success authentication
✔️ It forwards the call to app routes when unauth page access is enabled

✔️ Ui.Web.Tests.Endpoints.SerilogUiEndpointsTest

✔️ It gets logs
✔️ It gets logs keys
✔️ It gets logs with search parameters
✔️ It serializes an error on exception

✔️ Ui.Web.Tests.Extensions.ApplicationBuilderExtensionsTest

✔️ It not throws on null parameters
✔️ It register ui middleware
✔️ It throws on null deps

✔️ Ui.Web.Tests.Extensions.ContentInjectionTest

✔️ It appends multiple script tags
✔️ It appends multiple stylesheet tags
✔️ It appends script tag with customs
✔️ It appends script tag with defaults
✔️ It appends stylesheet tag with customs
✔️ It appends stylesheet tag with defaults
✔️ It mix scripts and stylesheets

✔️ Ui.Web.Tests.Extensions.HttpRequestExtensionsTest

✔️ It is local when no xforwarded and remote ip address is null
✔️ It is local when remote ip address equals local ip address
✔️ It is local when remote ip address is loopback
✔️ It is not local when remote ip address is not local nor loopback
✔️ It is not local when xforwarded

✔️ Ui.Web.Tests.SerilogUiMiddlewareTest

✔️ It hits ui endpoint when request matches method and custom options prefix(pathReq: "/test/", statusCode: 400)
✔️ It hits ui endpoint when request matches method and custom options prefix(pathReq: "/test/api/keys/", statusCode: 417)
✔️ It hits ui endpoint when request matches method and custom options prefix(pathReq: "/test/api/logs/", statusCode: 409)
✔️ It hits ui endpoint when request matches method and custom options prefix(pathReq: "/test/index.html", statusCode: 418)
✔️ It hits ui endpoint when request matches method and options prefix(pathReq: "/serilog-ui/", statusCode: 400)
✔️ It hits ui endpoint when request matches method and options prefix(pathReq: "/serilog-ui/api/keys/", statusCode: 417)
✔️ It hits ui endpoint when request matches method and options prefix(pathReq: "/serilog-ui/api/logs/", statusCode: 409)
✔️ It hits ui endpoint when request matches method and options prefix(pathReq: "/serilog-ui/index.html", statusCode: 418)
✔️ It proceeds onwards when request does not match options prefix(pathReq: "/fake-prefix/", statusCode: 400)
✔️ It proceeds onwards when request does not match options prefix(pathReq: "/fake-prefix/index.html", statusCode: 418)
✔️ It proceeds onwards when request does not match options prefix(pathReq: "fake-prefix/api/keys/", statusCode: 417)
✔️ It proceeds onwards when request does not match options prefix(pathReq: "fake-prefix/api/logs/", statusCode: 409)
✔️ It proceeds onwards when request is not a get(pathReq: "/serilog-ui/", statusCode: 400)
✔️ It proceeds onwards when request is not a get(pathReq: "/serilog-ui/api/keys/", statusCode: 417)
✔️ It proceeds onwards when request is not a get(pathReq: "/serilog-ui/api/logs/", statusCode: 409)
✔️ It proceeds onwards when request is not a get(pathReq: "/serilog-ui/index.html", statusCode: 418)