Experiment/whatsapp action UI mockup #40
Merged
GitHub Actions / Vitest
succeeded
Feb 4, 2025 in 1s
236 passed, 0 failed and 0 skipped
✅ reports/tests/test-results.xml
236 tests were completed in 16s with 236 passed, 0 failed and 0 skipped.
✅ src/index.test.ts
src/index.test.ts
✅ sum test > adds 1 + 2 to equal 3
✅ src/lib/comps/forms/whatsapp/messages/builder/actions/actions.test.ts
src/lib/comps/forms/whatsapp/messages/builder/actions/actions.test.ts
✅ createWhatsAppMessageAction > should append a new action when an array exists
✅ createWhatsAppMessageAction > should append a new buttonId if there is an existing buttonId with actions
✅ createWhatsAppMessageAction > should create a new array if id does not exist
✅ createWhatsAppMessageAction > should not mutate the original actions object
✅ createWhatsAppMessageAction > should handle an existing id with a non-array value gracefully
✅ createWhatsAppMessageAction > should not modify other ids in the actions object
✅ createEventRegistrationAction > should append a new action when an array exists
✅ createEventRegistrationAction > should append a new buttonId if there is an existing buttonId with actions
✅ createEventRegistrationAction > should create a new array if id does not exist
✅ createEventRegistrationAction > should not mutate the original actions object
✅ createEventRegistrationAction > should handle an existing id with a non-array value gracefully
✅ createEventRegistrationAction > should not modify other ids in the actions object
✅ updateEventRegistrationAction > should update event_id if action type is "register_for_event"
✅ updateEventRegistrationAction > should return the original action if type is not "register_for_event"
✅ src/lib/comps/forms/whatsapp/messages/builder/actions/buttons.test.ts
src/lib/comps/forms/whatsapp/messages/builder/actions/buttons.test.ts
✅ addButton > should add a button to an interactive message
✅ addButton > should convert a text message to an interactive message with a button
✅ addButton > should convert an image message to an interactive message with a button
✅ addButton > should return the original message if type is not interactive, text, or image
✅ removeButton > should remove a button from an interactive message
✅ removeButton > should convert an interactive message with one button into a text message
✅ removeButton > should convert an interactive message with an image and one button into an image message
✅ removeButton > should return the original message if it is not interactive
✅ src/lib/comps/forms/whatsapp/messages/builder/actions/components.test.ts
src/lib/comps/forms/whatsapp/messages/builder/actions/components.test.ts
✅ extractTemplateMessageParams > should extract header, body, and buttons
✅ interpolateTextParams > should replace placeholders with provided text
✅ templateMessageParamsIndexes > should return correct indexes for components
✅ extractComponents > should extract header, body, footer, and buttons
✅ countTextTemplatePlaceholders > should count the number of placeholders correctly
✅ extractTemplateMessageComponents > should extract message components
✅ createMessageComponentsFromTemplateComponents > should extract components from a template message
✅ createMessageComponentsFromTemplateComponents > should return an empty array for a non-template message type
✅ src/lib/comps/forms/whatsapp/messages/builder/actions/images.test.ts
src/lib/comps/forms/whatsapp/messages/builder/actions/images.test.ts
✅ removeImage > should convert an image message to a text message with its caption
✅ removeImage > should convert an image message to a text message with an empty caption if none exists
✅ removeImage > should remove the image from an interactive message while keeping the rest unchanged
✅ removeImage > should return the message unchanged if it is not an image or interactive message
✅ extractImageUrl > should return the image URL from an image message
✅ extractImageUrl > should return the image URL from an interactive message with an image header
✅ extractImageUrl > should return null for an interactive message without an image header
✅ extractImageUrl > should return null for a non-image message
✅ setImageUrl > should update the image URL in an image message
✅ setImageUrl > should set an image URL in an interactive message
✅ setImageUrl > should convert a text message to an image message while preserving the text as a caption
✅ setImageUrl > should return the message unchanged if it is not an image, text, or interactive message
✅ src/lib/comps/forms/whatsapp/messages/builder/actions/text.test.ts
src/lib/comps/forms/whatsapp/messages/builder/actions/text.test.ts
✅ extractText > should extract text from a text message
✅ extractText > should extract text from an interactive message
✅ extractText > should extract caption from an image message
✅ extractText > should return an empty string for other message types
✅ setText > should update the text body of a text message
✅ setText > should update the body text of an interactive message
✅ setText > should update the caption of an image message
✅ setText > should return the original message for unsupported types
✅ src/lib/comps/ui/form/controls/file_upload/upload.test.ts
src/lib/comps/ui/form/controls/file_upload/upload.test.ts
✅ checkFileType > should not throw an error if file type is allowed
✅ checkFileType > should throw an error if file type is not allowed
✅ checkFileType > should include all allowed types in the error message
✅ checkFileSize > should not throw an error if file size is within limit
✅ checkFileSize > should throw an error if file size exceeds limit
✅ checkFileSize > should format the max size correctly in the error message
✅ src/lib/schema/utils/openai.test.ts
src/lib/schema/utils/openai.test.ts
✅ Validation schemas for OpenAI integration > Accepts the specified types of schemas
✅ Validation schemas for OpenAI integration > Rejects invalid types of schemas
✅ src/lib/schema/valibot-date.test.ts
src/lib/schema/valibot-date.test.ts
✅ timestamp > should parse a timestamp
✅ timestamp > should parse a representation of a date, always outputting a JS date
✅ timestamp > should parse a Javascript date type
✅ timestamp > should throw an error if the input is not a valid date
✅ timestamp > should throw an error if the input is not a string
✅ timestamp > should throw an error if the input is null
✅ timestamp > should return a Date of the current time when undefined
✅ timestampNoDefault > should parse a timestamp
✅ timestampNoDefault > should parse a date
✅ timestampNoDefault > should throw an error if the input is not a valid date
✅ timestampNoDefault > should throw an error if the input is not a string
✅ timestampNoDefault > should throw an error if the input is null
✅ timestampNoDefault > should throw an error if the input is undefined
✅ isoTimestamp > should parse an ISO timestamp
✅ isoTimestamp > should output an ISO timestamp
✅ isoTimestamp > should throw an error if the input is not a string
✅ isoTimestamp > should throw an error if the input is a Date
✅ src/lib/schema/valibot-numbers.test.ts
src/lib/schema/valibot-numbers.test.ts
✅ id > should parse an integer id
✅ id > should throw an error if the input is not an integer
✅ id > should throw an error if the input is not a number
✅ id > should throw an error if the input is negative
✅ id > should throw an error if the input is zero
✅ id > should throw an error if the input is NaN
✅ integer > should parse an integer
✅ integer > should throw an error if the input is not an integer
✅ integer > should throw an error if the input is not a number
✅ count > should parse a count
✅ count > should throw an error if the input is not an integer
✅ count > should throw an error if the input is not a number
✅ count > should throw an error if the input is negative
✅ count > should parse a count of zero
✅ src/lib/schema/valibot-strings.test.ts
src/lib/schema/valibot-strings.test.ts
✅ shortString > should parse a short string
✅ shortString > should throw an error if the input is too long
✅ shortString > should throw an error if the input is not a string
✅ shortString > should throw an error if the input is null
✅ shortString > should parse even if the string is empty
✅ shortString > should parse a string that is the max length
✅ shortString > should throw an error if the input is too long
✅ shortStringNotEmpty > should parse a short string
✅ shortStringNotEmpty > should parse a string that is the max length
✅ shortStringNotEmpty > should throw an error if the input is too long
✅ shortStringNotEmpty > should throw an error if the input is not a string
✅ shortStringNotEmpty > should throw an error if the input is empty
✅ mediumString > should parse a medium string
✅ mediumString > should throw an error if the input is too long
✅ mediumString > should throw an error if the input is not a string
✅ mediumString > should throw an error if the input is null
✅ mediumString > should parse even if the string is empty
✅ mediumString > should parse a string that is the max length
✅ mediumString > should throw an error if the input is too long
✅ mediumStringNotEmpty > should parse a medium string
✅ mediumStringNotEmpty > should parse a string that is the max length
✅ mediumStringNotEmpty > should throw an error if the input is too long
✅ mediumStringNotEmpty > should throw an error if the input is not a string
✅ mediumStringNotEmpty > should throw an error if the input is empty
✅ longString > should parse a long string
✅ longString > should throw an error if the input is too long
✅ longString > should throw an error if the input is not a string
✅ longString > should throw an error if the input is null
✅ longString > should parse even if the string is empty
✅ longString > should parse a string that is the max length
✅ longString > should throw an error if the input is too long
✅ longStringNotEmpty > should parse a long string
✅ longStringNotEmpty > should parse a string that is the max length
✅ longStringNotEmpty > should throw an error if the input is too long
✅ longStringNotEmpty > should throw an error if the input is not a string
✅ longStringNotEmpty > should throw an error if the input is empty
✅ slug > should parse a slug
✅ slug > should throw an error if the input is not a string
✅ slug > should throw an error if the input is null
✅ slug > should throw an error if the input string is empty
✅ slug > should throw an error if the input is too long
✅ slug > should parse a string that is the max length
✅ slug > should throw an error if the input is not a slug
✅ slug > should parse a string that contains understores
✅ slug > should parse a string that contains dashes
✅ slug > should parse any slugified string that is between 1 character and the maximum length
✅ eamil > should return the email string for valid email addresses
✅ eamil > should throw for incorrect email addresses
✅ eamil > should throw for empty and whitespace-only strings
✅ eamil > should throw for emails with special characters in wrong places
✅ eamil > should throw for emails with spaces
✅ url > should return the url string for valid URLs
✅ url > should return the URL string even for that are not http or https
✅ url > should throw when receiving just a domain
✅ url > should throw when receiving non URL strings
✅ url > should throw when receiving input that is not a string
✅ url > should throw for empty and whitespace-only strings
✅ uuid > should parse a UUID
✅ uuid > should throw an error if the input is not a UUID
✅ uuid > should throw an error if the input is not a string
✅ uuid > should throw an error if the input is an empty string
✅ src/lib/server/api/people/interactions.test.ts
src/lib/server/api/people/interactions.test.ts
✅ Updating the notes that have been recorded on a person record > Should update the note and move the old note to the edit history
✅ Updating the notes that have been recorded on a person record > Should update a note with existing edit history and create a new entry at the end of the edit history array
✅ Updating the notes that have been recorded on a person record > Should throw an error when the previous note is not of type notes
✅ src/lib/server/hooks/handlers.test.ts
src/lib/server/hooks/handlers.test.ts
✅ detectSubdomain > should return false if the host is the root domain
✅ detectSubdomain > should return false if the host is localhost, regardless of the settings of the root domain
✅ detectSubdomain > should mistakenly return a root domain as a subdomain for multi-part ccTLDs/compound ccTLDs
✅ detectSubdomain > should return false even for multi-part ccTLDs/compound ccTLDs if the host is the root domain
✅ detectSubdomain > should return the subdomain if the host is not the root domain
✅ detectSubdomain > should return the correct subdomain when the host is localhost
✅ detectSubdomain > should return the subdomain even if the root domain is a multi-part ccTLD/compound ccTLD
✅ detectSubdomain > should return false if the subdomain is disallowed
✅ src/lib/server/utils/openai/schemas/HTMLMeta.test.ts
src/lib/server/utils/openai/schemas/HTMLMeta.test.ts
✅ JSONSchema definition for OpenAI html Metatag generation > Matches the valibot schema for the base HTML metatag object
✅ JSONSchema definition for OpenAI html Metatag generation > Matches the valibot schema for OpenGraph
✅ JSONSchema definition for OpenAI html Metatag generation > Matches the valibot schema for Twitter
✅ OpenAI html Metatag generation > Generates the expected html metatags
✅ OpenAI html Metatag generation > Calls the OpenAI API with the correct prompt
✅ src/lib/utils/math/number.test.ts
src/lib/utils/math/number.test.ts
✅ isBigger > should return true if a is bigger than b
✅ isBigger > should return false if a is smaller than b
✅ isBigger > should return false if a is equal to b
✅ isBigger > should return false if a is a negative number and b is a positive number
✅ isBigger > should return true if a is a positive number and b is a negative number
✅ isBigger > shouldn't be tricked by floating point precision
✅ isBigger > should return false if a is NaN
✅ isBigger > should return false if b is NaN
✅ isBigger > should return false if a and b are NaN
✅ isBigger > should return true if a is Infinity
✅ isBigger > should return false if b is Infinity
✅ isBigger > should return false if a is -Infinity
✅ isBigger > should return true if b is -Infinity
✅ isBigger > should return false if a is -Infinity and b is Infinity
✅ isBigger > should return true if a is Infinity and b is -Infinity
✅ isBigger > should return false if a is -0
✅ isBigger > should return false if b is -0
✅ isBigger > shouldn't be tricked by integer overflows
✅ src/lib/utils/text/file_size.test.ts
src/lib/utils/text/file_size.test.ts
✅ humanReadableFileSize > should return "0 B" for 0 bytes
✅ humanReadableFileSize > should return bytes in base 1024 by default
✅ humanReadableFileSize > should return bytes in SI base 1000 when `si` is true
✅ humanReadableFileSize > should handle larger units in base 1024
✅ humanReadableFileSize > should handle larger units in SI base 1000
✅ humanReadableFileSize > should round to the specified number of decimal places
✅ humanReadableFileSize > should handle negative byte values
✅ humanReadableFileSize > should handle edge cases for small values close to thresholds
✅ humanReadableFileSize > should handle extremely large values
✅ src/lib/utils/text/string.test.ts
src/lib/utils/text/string.test.ts
✅ addLineBreaks > should add line breaks to a string
✅ addLineBreaks > should convert all line breaks to <br> tags
✅ addLineBreaks > should convert multiple line breaks to multiple <br> tags
✅ sanitizeHTML > should remove script tags
✅ sanitizeHTML > should remove inline event handlers
✅ sanitizeHTML > should retain inline styles
✅ sanitizeHTML > removes event handlers like onerror from <img> tags
✅ sanitizeHTML > sanitizes invalid <svg> content by removing onload attributes and fixing structure
✅ sanitizeHTML > removes malicious <iframe> tags while preserving safe text
✅ sanitizeHTML > cleans <math> tags by removing dangerous xlink:href attributes
✅ sanitizeHTML > corrects malformed <table> structures, ensuring valid HTML output
✅ sanitizeHTML > sanitizes improperly nested <ul> and <a> tags and ensures valid structure
✅ Utility function to convert strings into slugs > Converts spaces to underscores
✅ Utility function to convert strings into slugs > Converts multiple spaces to a single underscore
✅ Utility function to convert strings into slugs > Converts dashes and semicolons to a single underscore
✅ Utility function to convert strings into slugs > Replaces multiple underscores with a single underscore
✅ Utility function to convert strings into slugs > Converts all strings to lowercase
✅ Utility function to convert strings into slugs > Strips accents and diacritics from latin characters
✅ Utility function to convert strings into slugs > Removes all non latin characters
✅ src/routes/(api)/api/v1/settings/secrets/secrets.test.ts
src/routes/(api)/api/v1/settings/secrets/secrets.test.ts
✅ PUT /settings/secrets > should update secrets successfully
✅ PUT /settings/secrets > should handle errors
✅ GET /settings/secrets > should read secrets successfully
✅ GET /settings/secrets > should handle errors
✅ src/routes/(api)/api/v1/settings/secrets/server.test.ts
src/routes/(api)/api/v1/settings/secrets/server.test.ts
✅ PUT /settings/secrets > should update secrets successfully
✅ PUT /settings/secrets > should handle errors
✅ GET /settings/secrets > should read secrets successfully
✅ GET /settings/secrets > should handle errors
✅ src/routes/(app)/people/[person_id]/activity_feed/notes/actions.test.ts
src/routes/(app)/people/[person_id]/activity_feed/notes/actions.test.ts
✅ updateNotes > should send a PUT request with sanitized notes
✅ updateNotes > should throw an error if the fetch request fails
✅ updateNotes > should sanitize HTML input in the notes
✅ src/routes/(app)/settings/admins/admins.test.ts
src/routes/(app)/settings/admins/admins.test.ts
✅ Admin List Page Server > loads admin list successfully
✅ Admin List Page Server > validates schema
✅ Edit Admin Page Server > loads single admin successfully
✅ src/routes/(app)/settings/admins/server.test.ts
src/routes/(app)/settings/admins/server.test.ts
✅ Admin List Page Server > loads admin list successfully
✅ Admin List Page Server > validates schema
✅ Edit Admin Page Server > loads single admin successfully
✅ src/routes/(app)/settings/secrets/secrets.test.ts
src/routes/(app)/settings/secrets/secrets.test.ts
✅ Secrets Page Server Load > should load secrets successfully
✅ Validation schema for secrets > Contains WHATSAPP_ACCESS_KEY key
✅ Validation schema for secrets > Accepts specified schemas, including any extra keys not defined in schema
✅ src/routes/(app)/settings/secrets/server.test.ts
src/routes/(app)/settings/secrets/server.test.ts
✅ Secrets Page Server Load > should load secrets successfully
✅ Validation schema for secrets > Contains WHATSAPP_ACCESS_KEY key
✅ Validation schema for secrets > Accepts specified schemas, including any extra keys not defined in schema
Loading