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 c348565
Showing 1 changed file with 176 additions and 29 deletions.
205 changes: 176 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,198 @@
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.
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
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
<-- 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

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"
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 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
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
<-- 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

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"
@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 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
end
end
end

0 comments on commit c348565

Please sign in to comment.