forked from instructure/canvas-lms
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTurnitinSettingsSpec.coffee
More file actions
119 lines (98 loc) · 3.87 KB
/
Copy pathTurnitinSettingsSpec.coffee
File metadata and controls
119 lines (98 loc) · 3.87 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
106
107
108
109
110
111
112
113
114
115
116
117
118
119
define [
'compiled/models/TurnitinSettings'
], ( TurnitinSettings ) ->
QUnit.module "TurnitinSettings"
QUnit.module "TurnitinSettings#constructor"
test "assigns originalityReportVisibility", ->
ts = new TurnitinSettings originality_report_visibility: 'after_grading'
strictEqual ts.originalityReportVisibility, 'after_grading'
test "assigns sPaperCheck", ->
ts = new TurnitinSettings s_paper_check: true
strictEqual ts.sPaperCheck, true
test "assigns internetCheck", ->
ts = new TurnitinSettings internet_check: true
strictEqual ts.internetCheck, true
test "assigns excludeBiblio", ->
ts = new TurnitinSettings exclude_biblio: false
strictEqual ts.excludeBiblio, false
test "assigns excludeQuoted", ->
ts = new TurnitinSettings exclude_quoted: false
strictEqual ts.excludeQuoted, false
test "assigns journalCheck", ->
ts = new TurnitinSettings journal_check: true
strictEqual ts.journalCheck, true
test "works with '0' and '1' as well", ->
ts = new TurnitinSettings
s_paper_check: '0'
internet_check: '1'
exclude_biblio: '0'
exclude_quoted: '1'
journal_check: '0'
strictEqual ts.sPaperCheck, false
strictEqual ts.internetCheck, true
strictEqual ts.excludeBiblio, false
strictEqual ts.excludeQuoted, true
strictEqual ts.journalCheck, false
test "assigns excludeSmallMatchesType", ->
ts = new TurnitinSettings exclude_small_matches_type: 'words'
strictEqual ts.excludeSmallMatchesType, 'words'
test "assigns excludeSmallMatchesValue", ->
ts = new TurnitinSettings exclude_small_matches_value: 100
strictEqual ts.excludeSmallMatchesValue, 100
test "assigns correct percent", ->
ts = new TurnitinSettings
exclude_small_matches_type: 'words'
exclude_small_matches_value: 100
strictEqual ts.percent(), ""
ts = new TurnitinSettings
exclude_small_matches_type: 'percent'
exclude_small_matches_value: 100
strictEqual ts.percent(), 100
test "assigns correct words", ->
ts = new TurnitinSettings
exclude_small_matches_type: 'words'
exclude_small_matches_value: 100
strictEqual ts.words(), 100
ts = new TurnitinSettings
exclude_small_matches_type: 'percent'
exclude_small_matches_value: 100
strictEqual ts.words(), ""
QUnit.module "TurnitinSettings#toJSON"
test "it converts back to snake_case", ->
options =
exclude_small_matches_value: 100
exclude_small_matches_type: 'words'
journal_check: false
exclude_quoted: false
exclude_biblio: true
internet_check: true
originality_report_visibility: 'after_grading'
s_paper_check: true
submit_papers_to: false
ts = new TurnitinSettings options
deepEqual ts.toJSON(), options
QUnit.module "TurnitinSettings#excludesSmallMatches"
test "returns true when excludeSmallMatchesType is not null", ->
ts = new TurnitinSettings exclude_small_matches_type: 'words'
strictEqual ts.excludesSmallMatches(), true
test "returns false when excludeSmallMatchesType is null", ->
ts = new TurnitinSettings exclude_small_matches_type: null
strictEqual ts.excludesSmallMatches(), false
QUnit.module "TurnitinSettings#present",
setup: ->
@options =
exclude_small_matches_value: 100
exclude_small_matches_type: 'words'
journal_check: false
exclude_quoted: false
exclude_biblio: true
internet_check: true
originality_report_visibility: 'after_grading'
s_paper_check: true
@ts = new TurnitinSettings @options
@view = @ts.present()
test "includes excludesSmallMatches", ->
strictEqual @view.excludesSmallMatches, @ts.excludesSmallMatches()
test "includes all the default fields", ->
for own key,value of @view when key != 'excludesSmallMatches' && key != 'words' && key != 'percent'
strictEqual value, @ts[ key ]