mattermost/server/public
Julien Tant 1dea4b1378
Add unit tests for ScheduledPost model (#35565)
* Add unit tests for ScheduledPost model

Cover all methods: BaseIsValid, IsValid, PreSave, PreUpdate, ToPost,
Auditable, RestoreNonUpdatableFields, SanitizeInput, and GetPriority.
Includes validation branch coverage through Draft delegation chain.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Address review findings for ScheduledPost tests

- Use require.Nil on valid-path validation checks (match post_test.go)
- Use require.Error/require.Nil on error-path ToPost subtests
- Add require.NotNil guards for inner pointer fields before dereference
- Add ToPost test for non-nil Metadata with empty Priority

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Fix typo in ScheduledPost.ToPost comment

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Seed real metadata fields in ToPost preservation tests

Populate Embeds in both metadata subtests and assert they survive
ToPost(), catching any replacement of the metadata struct.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

* Improve ScheduledPost Auditable metadata test to verify content preservation

Seed a real PostMetadata with an emoji and assert the auditable output
matches metadata.Auditable() instead of just checking non-nil.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>

---------

Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
2026-03-18 09:14:17 -07:00
..
model Add unit tests for ScheduledPost model (#35565) 2026-03-18 09:14:17 -07:00
plugin [MM-67739] Rename SlackAttachment to MessageAttachment across the codebase (#35445) 2026-03-10 16:37:21 +01:00
pluginapi [MM-67739] Rename SlackAttachment to MessageAttachment across the codebase (#35445) 2026-03-10 16:37:21 +01:00
shared MM-67268: Fix SSRF bypass via IPv4-mapped IPv6 literals (#35097) 2026-01-29 14:36:47 +01:00
utils Use golangci-lints's build-in modernize linter (#34341) 2025-11-04 12:09:11 +01:00
go.mod bumps go version to 1.24.13 (#35289) 2026-02-13 17:39:39 +01:00
go.sum Add Default Agent Support and promote Agents to be part of suite (#35091) 2026-02-12 02:59:20 +00:00
LICENSE.txt add Apache 2.0 license to public submodule (#23945) 2023-07-07 10:56:42 -03:00
Makefile [MM-53968] Includes mattermost-plugin-api into the mono repo (#24235) 2023-08-21 09:50:30 +02:00