-
Notifications
You must be signed in to change notification settings - Fork 12
Expand file tree
/
Copy pathdocx_conversion_spec.rb
More file actions
105 lines (90 loc) · 4.79 KB
/
docx_conversion_spec.rb
File metadata and controls
105 lines (90 loc) · 4.79 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
# frozen_string_literal: true
require 'spec_helper'
describe 'Conversion tests from docx' do
it 'Conversion | docx to docx' do
parsed_output_file = builder.build_and_parse('js/conversion/docx/docx_to_docx.js')
expect(parsed_output_file).to be_with_data
end
it 'Conversion | docx to docxf' do
parsed_output_file = builder.build_and_parse('js/conversion/docx/docx_to_docxf.js')
ext = builder.recognize_output_format(File.read('js/conversion/docx/docx_to_docxf.js'))
expect(File.extname(parsed_output_file.file_path).strip.downcase[1..]).to eq(ext)
expect(parsed_output_file).to be_with_data
end
it 'Conversion | docx to docm' do
parsed_output_file = builder.build_and_parse('js/conversion/docx/docx_to_docm.js')
ext = builder.recognize_output_format(File.read('js/conversion/docx/docx_to_docm.js'))
expect(File.extname(parsed_output_file.file_path).strip.downcase[1..]).to eq(ext)
expect(parsed_output_file).to be_with_data
end
it 'Conversion | docx to dotx' do
parsed_output_file = builder.build_and_parse('js/conversion/docx/docx_to_dotx.js')
ext = builder.recognize_output_format(File.read('js/conversion/docx/docx_to_dotx.js'))
expect(File.extname(parsed_output_file.file_path).strip.downcase[1..]).to eq(ext)
expect(parsed_output_file).to be_with_data
end
it 'Conversion | docx to dotm' do
parsed_output_file = builder.build_and_parse('js/conversion/docx/docx_to_dotm.js')
ext = builder.recognize_output_format(File.read('js/conversion/docx/docx_to_dotm.js'))
expect(File.extname(parsed_output_file.file_path).strip.downcase[1..]).to eq(ext)
expect(parsed_output_file).to be_with_data
end
it 'Conversion | docx to pdf' do
parsed_output_file = builder.build_and_parse('js/conversion/docx/docx_to_pdf.js')
ext = builder.recognize_output_format(File.read('js/conversion/docx/docx_to_pdf.js'))
expect(File.extname(parsed_output_file.file_path).strip.downcase[1..]).to eq(ext)
expect(parsed_output_file.pages[0][:text]).to eq('This is just a sample text. Nothing special.')
end
it 'Conversion | docx to epub' do
output_file = builder.build_file('js/conversion/docx/docx_to_epub.js')
ext = builder.recognize_output_format(File.read('js/conversion/docx/docx_to_epub.js'))
expect(File.extname(output_file).strip.downcase[1..]).to eq(ext)
expect(builder).not_to be_file_empty(output_file)
end
it 'Conversion | docx to fb2' do
output_file = builder.build_file('js/conversion/docx/docx_to_fb2.js')
ext = builder.recognize_output_format(File.read('js/conversion/docx/docx_to_fb2.js'))
expect(File.extname(output_file).strip.downcase[1..]).to eq(ext)
expect(builder).not_to be_file_empty(output_file)
end
it 'Conversion | docx to html' do
output_file = builder.build_file('js/conversion/docx/docx_to_html.js')
ext = builder.recognize_output_format(File.read('js/conversion/docx/docx_to_html.js'))
expect(File.extname(output_file).strip.downcase[1..]).to eq(ext)
expect(builder).not_to be_file_empty(output_file)
end
it 'Conversion | docx to ott' do
output_file = builder.build_file('js/conversion/docx/docx_to_ott.js')
ext = builder.recognize_output_format(File.read('js/conversion/docx/docx_to_ott.js'))
expect(File.extname(output_file).strip.downcase[1..]).to eq(ext)
expect(builder).not_to be_file_empty(output_file)
end
it 'Conversion | docx to odt' do
output_file = builder.build_file('js/conversion/docx/docx_to_odt.js')
ext = builder.recognize_output_format(File.read('js/conversion/docx/docx_to_odt.js'))
expect(File.extname(output_file).strip.downcase[1..]).to eq(ext)
expect(builder).not_to be_file_empty(output_file)
end
it 'Conversion | Docx to Pdf' do
output_file = builder.build_file('js/conversion/docx/docx_to_pdf.js')
expect(builder).not_to be_file_empty(output_file)
end
it 'Conversion | docx to pdfa' do
output_file = builder.build_file('js/conversion/docx/docx_to_pdfa.js')
ext = builder.recognize_output_format(File.read('js/conversion/docx/docx_to_pdfa.js'))
expect(File.extname(output_file).strip.downcase[1..]).to eq(ext)
expect(builder).not_to be_file_empty(output_file)
end
it 'Conversion | docx to rtf' do
output_file = builder.build_file('js/conversion/docx/docx_to_rtf.js')
ext = builder.recognize_output_format(File.read('js/conversion/docx/docx_to_rtf.js'))
expect(File.extname(output_file).strip.downcase[1..]).to eq(ext)
expect(builder).not_to be_file_empty(output_file)
end
it 'Conversion | Docx to Txt' do
output_file = builder.build_file('js/conversion/docx/docx_to_txt.js')
ext = builder.recognize_output_format(File.read('js/conversion/docx/docx_to_txt.js'))
expect(File.extname(output_file).strip.downcase[1..]).to eq(ext)
expect(builder).not_to be_file_empty(output_file)
end
end