-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[CHORE] RFC-0329 - adding deprecation about using evented in ember-data
- Loading branch information
pete
committed
May 17, 2019
1 parent
a9e1efb
commit 85461de
Showing
12 changed files
with
416 additions
and
168 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
import { test } from 'qunit'; | ||
import VERSION from 'ember-data/version'; | ||
|
||
// small comparison function for major and minor semver values | ||
function gte(EDVersion, DeprecationVersion) { | ||
let _edv = EDVersion.split('.'); | ||
let _depv = DeprecationVersion.split('.'); | ||
// compare major | ||
let major = +_edv[0] >= +_depv[0]; | ||
// compare minor | ||
let minor = +_edv[1] >= +_depv[1]; | ||
return major || minor; | ||
} | ||
|
||
export function deprecatedTest(testName, deprecation, testCallback) { | ||
// '4.0' | ||
if (typeof deprecation.until !== 'string' || deprecation.until.length < 3) { | ||
throw new Error(`deprecatedTest expects { until } to be a version.`); | ||
} | ||
// 'ds.<some-name>' | ||
if (typeof deprecation.id !== 'string' || deprecation.id.length < 8) { | ||
throw new Error(`deprecatedTest expects { id } to be a meaningful string`); | ||
} | ||
|
||
if (gte(VERSION, deprecation.until)) { | ||
test(`DEPRECATION ${deprecation.id} until ${deprecation.until} | ${testName}`, testCallback); | ||
} else { | ||
test(`DEPRECATION ${deprecation.id} until ${ | ||
deprecation.until | ||
} | ${testName}`, function(assert) { | ||
if (deprecation.refactor === true) { | ||
assert.ok( | ||
false, | ||
'This test includes use of a deprecated feature that should now be refactored.' | ||
); | ||
} else { | ||
assert.ok( | ||
false, | ||
'This test is for a deprecated feature whose time has come and should be removed' | ||
); | ||
} | ||
}); | ||
} | ||
} |
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
Oops, something went wrong.