forked from wikimedia-gadgets/twinkle
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b250839
commit e2cff9f
Showing
2 changed files
with
19 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,47 +1,47 @@ | ||
describe('modules/twinkletag', () => { | ||
describe('checkIncompatible', () => { | ||
test('no conflicts', () => { | ||
const conflictsToCheckFor = ['Bad GIF', 'Bad JPEG', 'Bad SVG', 'Bad format']; | ||
const incompatibleTags = ['Bad GIF', 'Bad JPEG', 'Bad SVG', 'Bad format']; | ||
const tagsToCheck = ['Better source requested']; | ||
const expected = undefined; | ||
expect(Twinkle.tag.checkIncompatible(conflictsToCheckFor, tagsToCheck)).toBe(expected); | ||
expect(Twinkle.tag.checkIncompatible(incompatibleTags, tagsToCheck)).toBe(expected); | ||
}); | ||
|
||
test('conflictsToCheckFor, tagsToCheck in alphabetical order', () => { | ||
const conflictsToCheckFor = ['Bad GIF', 'Bad JPEG', 'Bad SVG', 'Bad format']; | ||
test('incompatibleTags, tagsToCheck in alphabetical order', () => { | ||
const incompatibleTags = ['Bad GIF', 'Bad JPEG', 'Bad SVG', 'Bad format']; | ||
const tagsToCheck = ['Bad GIF', 'Bad JPEG']; | ||
const expected = true; | ||
expect(Twinkle.tag.checkIncompatible(conflictsToCheckFor, tagsToCheck)).toBe(expected); | ||
expect(Twinkle.tag.checkIncompatible(incompatibleTags, tagsToCheck)).toBe(expected); | ||
}); | ||
|
||
test('conflictsToCheckFor, tagsToCheck not in alphabetical order', () => { | ||
const conflictsToCheckFor = ['Bad GIF', 'Bad JPEG', 'Bad SVG', 'Bad format']; | ||
test('incompatibleTags, tagsToCheck not in alphabetical order', () => { | ||
const incompatibleTags = ['Bad GIF', 'Bad JPEG', 'Bad SVG', 'Bad format']; | ||
const tagsToCheck = ['Bad JPEG', 'Bad GIF']; | ||
const expected = true; | ||
expect(Twinkle.tag.checkIncompatible(conflictsToCheckFor, tagsToCheck)).toBe(expected); | ||
expect(Twinkle.tag.checkIncompatible(incompatibleTags, tagsToCheck)).toBe(expected); | ||
}); | ||
|
||
test('conflicts mixed with non-conflicts', () => { | ||
const conflictsToCheckFor = ['Bad GIF', 'Bad JPEG', 'Bad SVG', 'Bad format']; | ||
const incompatibleTags = ['Bad GIF', 'Bad JPEG', 'Bad SVG', 'Bad format']; | ||
const tagsToCheck = ['Better source requested', 'Bad GIF', 'Maybe free media', 'Bad JPEG', 'Copy to Commons']; | ||
const expected = true; | ||
expect(Twinkle.tag.checkIncompatible(conflictsToCheckFor, tagsToCheck)).toBe(expected); | ||
expect(Twinkle.tag.checkIncompatible(incompatibleTags, tagsToCheck)).toBe(expected); | ||
}); | ||
|
||
test('extra param, no conflicts', () => { | ||
const conflictsToCheckFor = ['Merge', 'Merge from', 'Merge to']; | ||
const incompatibleTags = ['Merge', 'Merge from', 'Merge to']; | ||
const tagsToCheck = ['One source']; | ||
const extraMessage = 'If several merges are required, use {{Merge}} and separate the article names with pipes (although in this case Twinkle cannot tag the other articles automatically).'; | ||
const expected = undefined; | ||
expect(Twinkle.tag.checkIncompatible(conflictsToCheckFor, tagsToCheck, extraMessage)).toBe(expected); | ||
expect(Twinkle.tag.checkIncompatible(incompatibleTags, tagsToCheck, extraMessage)).toBe(expected); | ||
}); | ||
|
||
test('extra param, conflicts', () => { | ||
const conflictsToCheckFor = ['Merge', 'Merge from', 'Merge to']; | ||
const incompatibleTags = ['Merge', 'Merge from', 'Merge to']; | ||
const tagsToCheck = ['Merge from', 'Merge to']; | ||
const extraMessage = 'If several merges are required, use {{Merge}} and separate the article names with pipes (although in this case Twinkle cannot tag the other articles automatically).'; | ||
const expected = true; | ||
expect(Twinkle.tag.checkIncompatible(conflictsToCheckFor, tagsToCheck, extraMessage)).toBe(expected); | ||
expect(Twinkle.tag.checkIncompatible(incompatibleTags, tagsToCheck, extraMessage)).toBe(expected); | ||
}); | ||
}); | ||
}); |