GitHub Actions / Test results (Node.js: 20)
succeeded
Dec 1, 2023 in 0s
Test results (Node.js: 20) ✅
✅ jest-junit.xml
122 tests were completed in 6s with 122 passed, 0 failed and 0 skipped.
Test suite | Passed | Failed | Skipped | Time |
---|---|---|---|---|
tests/unit/decorators/virtual-column.decorator.test.ts | 3✅ | 179ms | ||
tests/unit/providers/token.service.test.ts | 6✅ | 750ms | ||
tests/unit/utils/common.util.test.ts | 16✅ | 187ms | ||
tests/unit/utils/hash.util.test.ts | 15✅ | 555ms | ||
tests/unit/utils/ip.util.test.ts | 7✅ | 177ms | ||
tests/unit/utils/joi.util.test.ts | 4✅ | 242ms | ||
tests/unit/utils/mapping.util.test.ts | 4✅ | 182ms | ||
tests/unit/utils/number.util.test.ts | 14✅ | 189ms | ||
tests/unit/utils/request.util.test.ts | 6✅ | 256ms | ||
tests/unit/utils/string.util.test.ts | 29✅ | 3s | ||
tests/unit/utils/url.util.test.ts | 8✅ | 255ms | ||
tests/unit/utils/user-agent.util.test.ts | 10✅ | 196ms |
✅ tests/unit/decorators/virtual-column.decorator.test.ts
VirtualColumn
✅ should define metadata for the target with the property key as the name when no name is provided
✅ should define metadata for the target with the provided name
✅ should not overwrite existing metadata for the target
✅ tests/unit/providers/token.service.test.ts
TokenService › signJwt
✅ signs a valid JWT
TokenService › verify
✅ verifies a JWT
✅ verifies a JWT and gets data
TokenService › decode
✅ decodes a JWT
✅ decodes a JWT and gets data
✅ decodes a JWT and with a wrong secret
✅ tests/unit/utils/common.util.test.ts
CommonUtil › isEmpty
✅ should return true for null or undefined
✅ should return true for an empty string
✅ should return true for an empty array
✅ should return true for an empty object
✅ should return false for a non-empty string
✅ should return false for a non-empty array
✅ should return false for a non-empty object
✅ should return false for a number
✅ should return false for a boolean
CommonUtil › isNullOrUndefined
✅ should return true for null
✅ should return true for undefined
✅ should return false for an empty string
✅ should return false for a number
✅ should return false for a boolean
✅ should return false for an empty array
✅ should return false for an empty object
✅ tests/unit/utils/hash.util.test.ts
HashUtil › generateHashFromString
✅ should return a hash when a string is provided
✅ should return a different hash when a different string is provided
✅ should return the same hash when the same string is provided
HashUtil › generateRandomNumber
✅ should return a number with the specified length
✅ should return a different number on each call
✅ should return a number within the range of the specified length
HashUtil › generateUuid
✅ should return a string
✅ should return a different UUID on each call
✅ should return a valid UUID
HashUtil › hashPassword
✅ should return null when no password is provided
✅ should return a string when a password is provided
✅ should return a different hash when a different password is provided
HashUtil › isComparePassword
✅ should return false when no password or oldPassword is provided
✅ should return false when the oldPassword does not contain a salt or hashKey
✅ should return true when the password and oldPassword match
✅ tests/unit/utils/ip.util.test.ts
IpUtil › getIp
✅ should return cf-connecting-ip if it exists
✅ should return x-real-ip if cf-connecting-ip does not exist
✅ should return x-forwarded-for if cf-connecting-ip and x-real-ip do not exist
✅ should return req.ip if headers do not exist
✅ should return null if no ip is found
✅ should return the first ip if x-forwarded-for is an array
✅ should return the first ip if x-forwarded-for is a string of ips
✅ tests/unit/utils/joi.util.test.ts
JoiUtil › validate
✅ should return the value when it is valid
✅ should throw an error when the value is invalid
✅ should return the value when it is valid and the schema is complex
✅ should throw an error when the value is invalid and the schema is complex
✅ tests/unit/utils/mapping.util.test.ts
MappingUtil › objToDto
✅ should return an instance of the class when a class is provided
✅ should return the original data when no class is provided
✅ should return an array of instances of the class when an array of data and a class are provided
✅ should return the original array of data when an array of data and no class are provided
✅ tests/unit/utils/number.util.test.ts
NumberUtil › convertStringToNumber
✅ should return a number when a valid number string is provided
✅ should return a number when a valid number is provided
✅ should return 0 when an invalid number string is provided
✅ should return 0 when a non-number type is provided
✅ should return 0 when the input is null
✅ should return 0 when the input is undefined
NumberUtil › isNumber
✅ should return true when a number is provided
✅ should return true when a number string is provided
✅ should return false when a non-number string is provided
✅ should return false when an empty string is provided
✅ should return false when a non-number type is provided
✅ should return false when null is provided
✅ should return false when undefined is provided
✅ should return true when 0 is provided
✅ tests/unit/utils/request.util.test.ts
RequestUtil › get
✅ should return the expected data when the request is successful
✅ should throw an error when the request fails
✅ should throw an error when the response is not ok
RequestUtil › post
✅ should return the expected data when the request is successful
✅ should throw an error when the request fails
✅ should throw an error when the response is not ok
✅ tests/unit/utils/string.util.test.ts
StringUtil › capitalizeOnlyFirstChar
✅ should return the string with the first character capitalized
✅ should return the original string when the first character is already capitalized
✅ should return an empty string when the input is not a string
✅ should return an empty string when the input is undefined
✅ should return the original string when the string is empty
StringUtil › StringUtil › convertJsonToString
✅ should return a stringified JSON when a valid JSON is provided
✅ should return an empty string when the input is not a valid JSON
✅ should return a stringified JSON when an array is provided
✅ should return "null" when the input is null
✅ should return an empty string when the input is undefined
StringUtil › convertStringToJson
✅ should return a JSON object when a valid JSON string is provided
✅ should return an empty object when the input is not a valid JSON string
✅ should return a JSON array when a valid JSON array string is provided
✅ should return an empty object when the input is "null"
✅ should return an empty object when the input is "undefined"
StringUtil › decodeBase64ToString
✅ should return a decoded string when a valid base64 string is provided
✅ should return an empty string when the input is not a valid base64 string
✅ should return an empty string when the input is not a string
✅ should return an empty string when the input is null
✅ should return an empty string when the input is undefined
StringUtil › escape
✅ should return a string with special characters escaped
✅ should return the original string when there are no special characters to escape
✅ should return an empty string when the input is an empty string
✅ should return an empty string when the input is null
✅ should return an empty string when the input is undefined
StringUtil › replace
✅ should return a string with placeholders replaced by the corresponding values
✅ should return the original string when there are no placeholders to replace
✅ should return the original string when the keys object is empty
✅ should return a string with placeholders replaced by the corresponding values when a custom delimiter is provided
✅ tests/unit/utils/url.util.test.ts
UrlUtil › getDomain
✅ should return the domain name when a valid URL is provided
✅ should return "localhost" when the URL is not provided
✅ should return "localhost" when the URL is invalid
✅ should return "localhost" when the URL is "localhost"
UrlUtil › createUrl
✅ should return the URL with search parameters when valid URL and search parameters are provided
✅ should return the original URL when search parameters are not provided
✅ should return the original URL when the URL is invalid
✅ should not append null or undefined search parameters
✅ tests/unit/utils/user-agent.util.test.ts
UserAgetUtil › getBrowser
✅ should return the browser Chrome if user agent string is valid
✅ should return the browser Safari if user agent string is valid
✅ should return an empty string if user agent string is invalid
✅ should return an empty string if user agent string is undefined
✅ should return an empty string if user agent string is null
UserAgetUtil › getOS
✅ should return the OS Windows if user agent string is valid
✅ should return the browser macOS if user agent string is valid
✅ should return an empty string if user agent string is invalid
✅ should return an empty string if user agent string is undefined
✅ should return an empty string if user agent string is null
Loading