Skip to content

Commit

Permalink
Add full spec for asana_release_notes_extractor
Browse files Browse the repository at this point in the history
  • Loading branch information
ayoy committed Oct 1, 2024
1 parent 9847f1a commit ec67880
Show file tree
Hide file tree
Showing 2 changed files with 184 additions and 30 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def handle_pp_marker(line)
add_to_pp_notes("<h3 style=\"font-size:14px\">For Privacy Pro subscribers</h3>")
add_to_pp_notes("<ul>")
else
add_to_pp_notes(line.chomp)
add_to_pp_notes(line.strip)
end
end

Expand Down
212 changes: 183 additions & 29 deletions spec/asana_release_notes_extractor_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -103,51 +103,205 @@
end
end

shared_examples "extracting release notes" do |mode|
it "extracts release notes in #{mode} format" do
expect(subject.extract_release_notes(@input)).to eq(@output[mode.to_sym])
shared_context "non-empty release notes and missing Privacy Pro section" do
before do
@input = <<-INPUT
Note: This task's description is managed automatically.
Only the Release notes section below should be modified manually.
Please do not adjust formatting.
Release notes
You can now find browser windows listed in the "Window" app menu and in the Dock menu.
We also added "Duplicate Tab" to the app menu so you can use it as an action in Apple Shortcuts.
When watching videos in Duck Player, clicking endscreen recommendations will now open those videos in the same tab.
The bug that duplicated sites in your browsing history has been fixed, and the visual glitching that sometimes occurred during session restore and app launch has been addressed.
This release includes:
https://app.asana.com/0/0/0/f/
https://app.asana.com/0/0/0/f/
https://app.asana.com/0/0/0/f/
INPUT

raw = <<-RAW
You can now find browser windows listed in the "Window" app menu and in the Dock menu.
We also added "Duplicate Tab" to the app menu so you can use it as an action in Apple Shortcuts.
When watching videos in Duck Player, clicking endscreen recommendations will now open those videos in the same tab.
The bug that duplicated sites in your browsing history has been fixed, and the visual glitching that sometimes occurred during session restore and app launch has been addressed.
RAW

html = <<-HTML
<h3 style="font-size:14px">What's new</h3>
<ul>
<li>You can now find browser windows listed in the &quot;Window&quot; app menu and in the Dock menu.</li>
<li>We also added &quot;Duplicate Tab&quot; to the app menu so you can use it as an action in Apple Shortcuts.</li>
<li>When watching videos in Duck Player, clicking endscreen recommendations will now open those videos in the same tab.</li>
<li>The bug that duplicated sites in your browsing history has been fixed, and the visual glitching that sometimes occurred during session restore and app launch has been addressed.</li>
</ul>
HTML

asana = <<-ASANA
<ul><li>You can now find browser windows listed in the &quot;Window&quot; app menu and in the Dock menu.</li><li>We also added &quot;Duplicate Tab&quot; to the app menu so you can use it as an action in Apple Shortcuts.</li><li>When watching videos in Duck Player, clicking endscreen recommendations will now open those videos in the same tab.</li><li>The bug that duplicated sites in your browsing history has been fixed, and the visual glitching that sometimes occurred during session restore and app launch has been addressed.</li></ul>
ASANA

@output = {
raw: raw,
html: html,
asana: asana.chomp
}
end
end

context "html mode" do
subject { Fastlane::Helper::AsanaReleaseNotesExtractor.new(output_type: "html") }
shared_context "non-empty release notes and a placeholder Privacy Pro section" do
before do
@input = <<-INPUT
Note: This task's description is managed automatically.
Only the Release notes section below should be modified manually.
Please do not adjust formatting.
Release notes
context "placeholder release notes with placeholder Privacy Pro section" do
include_context "placeholder release notes with placeholder Privacy Pro section"
it_behaves_like "extracting release notes", "html"
end
You can now find browser windows listed in the "Window" app menu and in the Dock menu.
We also added "Duplicate Tab" to the app menu so you can use it as an action in Apple Shortcuts.
When watching videos in Duck Player, clicking endscreen recommendations will now open those videos in the same tab.
The bug that duplicated sites in your browsing history has been fixed, and the visual glitching that sometimes occurred during session restore and app launch has been addressed.
context "non-empty release notes with non-empty Privacy Pro section" do
include_context "non-empty release notes with non-empty Privacy Pro section"
it_behaves_like "extracting release notes", "html"
For Privacy Pro subscribers
<-- Add release notes here -->
This release includes:
https://app.asana.com/0/0/0/f/
https://app.asana.com/0/0/0/f/
https://app.asana.com/0/0/0/f/
INPUT

raw = <<-RAW
You can now find browser windows listed in the "Window" app menu and in the Dock menu.
We also added "Duplicate Tab" to the app menu so you can use it as an action in Apple Shortcuts.
When watching videos in Duck Player, clicking endscreen recommendations will now open those videos in the same tab.
The bug that duplicated sites in your browsing history has been fixed, and the visual glitching that sometimes occurred during session restore and app launch has been addressed.
RAW

html = <<-HTML
<h3 style="font-size:14px">What's new</h3>
<ul>
<li>You can now find browser windows listed in the &quot;Window&quot; app menu and in the Dock menu.</li>
<li>We also added &quot;Duplicate Tab&quot; to the app menu so you can use it as an action in Apple Shortcuts.</li>
<li>When watching videos in Duck Player, clicking endscreen recommendations will now open those videos in the same tab.</li>
<li>The bug that duplicated sites in your browsing history has been fixed, and the visual glitching that sometimes occurred during session restore and app launch has been addressed.</li>
</ul>
HTML

asana = <<-ASANA
<ul><li>You can now find browser windows listed in the &quot;Window&quot; app menu and in the Dock menu.</li><li>We also added &quot;Duplicate Tab&quot; to the app menu so you can use it as an action in Apple Shortcuts.</li><li>When watching videos in Duck Player, clicking endscreen recommendations will now open those videos in the same tab.</li><li>The bug that duplicated sites in your browsing history has been fixed, and the visual glitching that sometimes occurred during session restore and app launch has been addressed.</li></ul>
ASANA

@output = {
raw: raw,
html: html,
asana: asana.chomp
}
end
end

context "asana mode" do
subject { Fastlane::Helper::AsanaReleaseNotesExtractor.new(output_type: "asana") }
shared_context "non-empty release notes and Privacy Pro release header as a bullet point inside regular release notes" do
before do
@input = <<-INPUT
Note: This task's description is managed automatically.
Only the Release notes section below should be modified manually.
Please do not adjust formatting.
Release notes
You can now find browser windows listed in the "Window" app menu and in the Dock menu.
We also added "Duplicate Tab" to the app menu so you can use it as an action in Apple Shortcuts.
When watching videos in Duck Player, clicking endscreen recommendations will now open those videos in the same tab.
The bug that duplicated sites in your browsing history has been fixed, and the visual glitching that sometimes occurred during session restore and app launch has been addressed.
For Privacy Pro subscribers
VPN updates! More detailed connection info in the VPN dashboard, plus animations and usability improvements.
Visit https://duckduckgo.com/pro for more information. Privacy Pro is currently available to U.S. residents only.
This release includes:
https://app.asana.com/0/0/0/f/
https://app.asana.com/0/0/0/f/
https://app.asana.com/0/0/0/f/
INPUT

context "placeholder release notes with placeholder Privacy Pro section" do
include_context "placeholder release notes with placeholder Privacy Pro section"
it_behaves_like "extracting release notes", "asana"
raw = <<-RAW
You can now find browser windows listed in the "Window" app menu and in the Dock menu.
We also added "Duplicate Tab" to the app menu so you can use it as an action in Apple Shortcuts.
When watching videos in Duck Player, clicking endscreen recommendations will now open those videos in the same tab.
The bug that duplicated sites in your browsing history has been fixed, and the visual glitching that sometimes occurred during session restore and app launch has been addressed.
For Privacy Pro subscribers
VPN updates! More detailed connection info in the VPN dashboard, plus animations and usability improvements.
Visit https://duckduckgo.com/pro for more information. Privacy Pro is currently available to U.S. residents only.
RAW

html = <<-HTML
<h3 style="font-size:14px">What's new</h3>
<ul>
<li>You can now find browser windows listed in the &quot;Window&quot; app menu and in the Dock menu.</li>
<li>We also added &quot;Duplicate Tab&quot; to the app menu so you can use it as an action in Apple Shortcuts.</li>
<li>When watching videos in Duck Player, clicking endscreen recommendations will now open those videos in the same tab.</li>
<li>The bug that duplicated sites in your browsing history has been fixed, and the visual glitching that sometimes occurred during session restore and app launch has been addressed.</li>
</ul>
<h3 style="font-size:14px">For Privacy Pro subscribers</h3>
<ul>
<li>VPN updates! More detailed connection info in the VPN dashboard, plus animations and usability improvements.</li>
<li>Visit <a href="https://duckduckgo.com/pro">https://duckduckgo.com/pro</a> for more information. Privacy Pro is currently available to U.S. residents only.</li>
</ul>
HTML

asana = <<-ASANA
<ul><li>You can now find browser windows listed in the &quot;Window&quot; app menu and in the Dock menu.</li><li>We also added &quot;Duplicate Tab&quot; to the app menu so you can use it as an action in Apple Shortcuts.</li><li>When watching videos in Duck Player, clicking endscreen recommendations will now open those videos in the same tab.</li><li>The bug that duplicated sites in your browsing history has been fixed, and the visual glitching that sometimes occurred during session restore and app launch has been addressed.</li></ul><h2>For Privacy Pro subscribers</h2><ul><li>VPN updates! More detailed connection info in the VPN dashboard, plus animations and usability improvements.</li><li>Visit <a href="https://duckduckgo.com/pro">https://duckduckgo.com/pro</a> for more information. Privacy Pro is currently available to U.S. residents only.</li></ul>
ASANA

@output = {
raw: raw,
html: html,
asana: asana.chomp
}
end
end

context "non-empty release notes with non-empty Privacy Pro section" do
include_context "non-empty release notes with non-empty Privacy Pro section"
it_behaves_like "extracting release notes", "asana"
shared_examples "extracting release notes" do |mode|
it "extracts release notes in #{mode} format" do
expect(subject.extract_release_notes(@input)).to eq(@output[mode.to_sym])
end
end

context "raw mode" do
subject { Fastlane::Helper::AsanaReleaseNotesExtractor.new(output_type: "raw") }
["html", "asana", "raw"].each do |mode|
context "#{mode} mode" do
subject { Fastlane::Helper::AsanaReleaseNotesExtractor.new(output_type: mode) }

context "placeholder release notes with placeholder Privacy Pro section" do
include_context "placeholder release notes with placeholder Privacy Pro section"
it_behaves_like "extracting release notes", "raw"
end
context "placeholder release notes with placeholder Privacy Pro section" do
include_context "placeholder release notes with placeholder Privacy Pro section"
it_behaves_like "extracting release notes", mode
end

context "non-empty release notes with non-empty Privacy Pro section" do
include_context "non-empty release notes with non-empty Privacy Pro section"
it_behaves_like "extracting release notes", mode
end

context "non-empty release notes and missing Privacy Pro section" do
include_context "non-empty release notes and missing Privacy Pro section"
it_behaves_like "extracting release notes", mode
end

context "non-empty release notes and a placeholder Privacy Pro section" do
include_context "non-empty release notes and a placeholder Privacy Pro section"
it_behaves_like "extracting release notes", mode
end

context "non-empty release notes with non-empty Privacy Pro section" do
include_context "non-empty release notes with non-empty Privacy Pro section"
it_behaves_like "extracting release notes", "raw"
context "non-empty release notes and Privacy Pro release header as a bullet point inside regular release notes" do
include_context "non-empty release notes and Privacy Pro release header as a bullet point inside regular release notes"
it_behaves_like "extracting release notes", mode
end
end
end
end

0 comments on commit ec67880

Please sign in to comment.