-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Capture behaviour of existing diff library
- Loading branch information
Showing
2 changed files
with
58 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
package model.commands | ||
|
||
import com.gu.media.model.{Category, ContentChangeDetails, MediaAtom} | ||
import org.scalatest.{FunSuite, MustMatchers} | ||
|
||
class UpdateAtomCommandTest extends FunSuite with MustMatchers { | ||
val mediaAtomFixture: MediaAtom = MediaAtom( | ||
id = "123", | ||
labels = List.empty, | ||
assets = List.empty, | ||
activeVersion = Some(1), | ||
title = "title", | ||
category = Category.News, | ||
description = Some("description"), | ||
duration = Some(1), | ||
source = Some("source"), | ||
posterImage = None, | ||
trailText = None, | ||
youtubeTitle = "title", | ||
youtubeDescription = None, | ||
trailImage = None, | ||
tags = List.empty, | ||
byline = List.empty, | ||
commissioningDesks = List.empty, | ||
contentChangeDetails = ContentChangeDetails(None, None, None, 1L, None, None, None), | ||
privacyStatus = None, | ||
channelId = None, | ||
youtubeCategoryId = None, | ||
youtubeOverrideImage = None, | ||
keywords = List.empty, | ||
license = None, | ||
plutoData = None, | ||
blockAds = false, | ||
expiryDate = None, | ||
legallySensitive = None, | ||
sensitive = None, | ||
optimisedForWeb = None, | ||
composerCommentsEnabled = None, | ||
suppressRelatedContent = None | ||
) | ||
|
||
test("Diff output when nothing changes") { | ||
val str = UpdateAtomCommand.createDiffString(mediaAtomFixture, mediaAtomFixture) | ||
println(str) | ||
str must be( | ||
"""Updated atom fields (category = News$,, channelId = None,, description = Some( "description" ),, duration = Some( 1 ),, legallySensitive = None,, license = None,, source = Some( "source" ),, title = "title",, youtubeCategoryId = None,, youtubeTitle = "title")""" | ||
) | ||
} | ||
|
||
test("Diff output when description changes") { | ||
UpdateAtomCommand.createDiffString(mediaAtomFixture, mediaAtomFixture.copy(description = Some("New description"))) must be( | ||
"Updated atom fields (MediaAtom( ..., description = Some( \u001B\"description\"\u001B -> \u001B\"New description\"\u001B ) ))" | ||
) | ||
} | ||
} |