Commit 4363a69e authored by jasonych99's avatar jasonych99
Browse files

Add Report Label - Spec

parent 6de89376
...@@ -148,6 +148,9 @@ describe Chemotion::ReportAPI do ...@@ -148,6 +148,9 @@ describe Chemotion::ReportAPI do
{\"text\":\"whole_diagram\",\"checked\":true}]", {\"text\":\"whole_diagram\",\"checked\":true}]",
imgFormat: 'png', imgFormat: 'png',
fileName: fileName, fileName: fileName,
molSerials: "[{\"mol\":{\"id\":1, \"svgPath\":\"1a.svg\", \
\"sumFormula\":\"C6H6\", \"iupacName\":\"benzene\"}, \
\"value\":\"1a\"}]"
} }
end end
......
...@@ -31,6 +31,7 @@ const originalState = { ...@@ -31,6 +31,7 @@ const originalState = {
activeKey: 0, activeKey: 0,
processings: [], processings: [],
template: "supporting_information", template: "supporting_information",
selMolSerials: [],
} }
export { originalState, splSettings, rxnSettings, configs } export { originalState, splSettings, rxnSettings, configs }
...@@ -73,8 +73,24 @@ describe 'Reporter::Docx::DetailReaction instance' do ...@@ -73,8 +73,24 @@ describe 'Reporter::Docx::DetailReaction instance' do
ElementReportPermissionProxy.new(user, r1, [user.id]).serialized ElementReportPermissionProxy.new(user, r1, [user.id]).serialized
end end
let!(:serial) { '1a' }
let!(:mol_serials) do
mol = s2.molecule
[
{
'mol' => {
'id' => mol.id,
'svgPath' => mol.molecule_svg_file,
'sumFormula' => mol.sum_formular,
'iupacName' => mol.iupac_name
},
'value' => serial
}
]
end
let!(:target) do let!(:target) do
Reporter::Docx::DetailReaction.new(reaction: OpenStruct.new(r1_serialized), Reporter::Docx::DetailReaction.new(reaction: OpenStruct.new(r1_serialized),
mol_serials: mol_serials,
index: prev_index) index: prev_index)
end end
...@@ -132,11 +148,14 @@ describe 'Reporter::Docx::DetailReaction instance' do ...@@ -132,11 +148,14 @@ describe 'Reporter::Docx::DetailReaction instance' do
[ [
{"insert"=>"[4.#{prev_index + 1}] "}, {"insert"=>"[4.#{prev_index + 1}] "},
{"insert"=>"#{s2.molecule_name_hash[:label]}"}, {"insert"=>"#{s2.molecule_name_hash[:label]}"},
{"insert"=>" / "}, {"insert"=>" ("},
{"insert"=>serial},
{"insert"=>")"},
{"insert"=>", "},
{"insert"=>"#{s3.molecule_name_hash[:label]}"}, {"insert"=>"#{s3.molecule_name_hash[:label]}"},
{"insert"=>" ("}, {"insert"=>" ("},
{"attributes"=>{"bold"=>"true"}, "insert"=>"xx"}, {"insert"=>serial},
{"insert"=>")"} {"insert"=>")"},
] ]
) )
expect(target.send(:products_delta)).to eq( expect(target.send(:products_delta)).to eq(
...@@ -180,7 +199,7 @@ describe 'Reporter::Docx::DetailReaction instance' do ...@@ -180,7 +199,7 @@ describe 'Reporter::Docx::DetailReaction instance' do
[ [
{"insert"=>"#{tit}: "}, {"insert"=>"#{tit}: "},
{"insert"=>"{A|"}, {"insert"=>"{A|"},
{"attributes"=>{"bold"=>"true"}, "insert"=>"xx"}, {"insert"=>serial},
{"insert"=>"} "}, {"insert"=>"} "},
{"insert"=>"#{s2.molecule_name_hash[:label]}"}, {"insert"=>"#{s2.molecule_name_hash[:label]}"},
{"insert"=>" (1.000 g, 55.508 mmol, 0.88 equiv.); "}, {"insert"=>" (1.000 g, 55.508 mmol, 0.88 equiv.); "},
...@@ -190,11 +209,11 @@ describe 'Reporter::Docx::DetailReaction instance' do ...@@ -190,11 +209,11 @@ describe 'Reporter::Docx::DetailReaction instance' do
{"insert"=>" (0.00 mL); "}, {"insert"=>" (0.00 mL); "},
{"insert"=>"Yield "}, {"insert"=>"Yield "},
{"insert"=>"{C|"}, {"insert"=>"{C|"},
{"attributes"=>{"bold"=>"true"}, "insert"=>"xx"}, {"insert"=>serial},
{"insert"=>"} = #{(equiv * 100).to_i}% (0.000 g, 0.000 mmol)"}, {"insert"=>"} = #{(equiv * 100).to_i}% (0.000 g, 0.000 mmol)"},
{"insert"=>"; "}, {"insert"=>"; "},
{"insert"=>"{D|"}, {"insert"=>"{D|"},
{"attributes"=>{"bold"=>"true"}, "insert"=>"xx"}, {"insert"=>serial},
{"insert"=>"} = #{(equiv * 100).to_i}% (0.000 g, 0.000 mmol)"}, {"insert"=>"} = #{(equiv * 100).to_i}% (0.000 g, 0.000 mmol)"},
{"insert"=>"."}, {"insert"=>"."},
{"insert"=>"\n"}, {"insert"=>"\n"},
......
...@@ -111,7 +111,7 @@ MOLFILE ...@@ -111,7 +111,7 @@ MOLFILE
let(:mol_attributes){ let(:mol_attributes){
{ {
"boiling_point" => nil, "boiling_point" => nil,
"density" => nil, "density" => 0.0,
"inchikey" => "XLYOFNOQVPJJNP-UHFFFAOYSA-N", "inchikey" => "XLYOFNOQVPJJNP-UHFFFAOYSA-N",
"inchistring" => "InChI=1S/H2O/h1H2", "inchistring" => "InChI=1S/H2O/h1H2",
"iupac_name" => "oxidane", "iupac_name" => "oxidane",
......
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment