Skip to content

Commit

Permalink
expect prototype extension deprecation in tests
Browse files Browse the repository at this point in the history
  • Loading branch information
locks committed Oct 27, 2020
1 parent 591be24 commit c29007e
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 7 deletions.
4 changes: 3 additions & 1 deletion packages/@ember/string/tests/camelize_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import { moduleFor, AbstractTestCase } from 'internal-test-helpers';
function test(assert, given, expected, description) {
assert.deepEqual(camelize(given), expected, description);
if (ENV.EXTEND_PROTOTYPES.String) {
assert.deepEqual(given.camelize(), expected, description);
expectDeprecation(() => {
assert.deepEqual(given.camelize(), expected, description);
}, /String prototype extensions are deprecated/);
}
}

Expand Down
4 changes: 3 additions & 1 deletion packages/@ember/string/tests/capitalize_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import { moduleFor, AbstractTestCase } from 'internal-test-helpers';
function test(assert, given, expected, description) {
assert.deepEqual(capitalize(given), expected, description);
if (ENV.EXTEND_PROTOTYPES.String) {
assert.deepEqual(given.capitalize(), expected, description);
expectDeprecation(() => {
assert.deepEqual(given.capitalize(), expected, description);
}, /String prototype extensions are deprecated/)
}
}

Expand Down
5 changes: 4 additions & 1 deletion packages/@ember/string/tests/classify_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import { moduleFor, AbstractTestCase } from 'internal-test-helpers';
function test(assert, given, expected, description) {
assert.deepEqual(classify(given), expected, description);
if (ENV.EXTEND_PROTOTYPES.String) {
assert.deepEqual(given.classify(), expected, description);
expectDeprecation(() => {
assert.deepEqual(given.classify(), expected, description);
}, /String prototype extensions are deprecated/);

}
}

Expand Down
4 changes: 3 additions & 1 deletion packages/@ember/string/tests/dasherize_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import { moduleFor, AbstractTestCase } from 'internal-test-helpers';
function test(assert, given, expected, description) {
assert.deepEqual(dasherize(given), expected, description);
if (ENV.EXTEND_PROTOTYPES.String) {
assert.deepEqual(given.dasherize(), expected, description);
expectDeprecation(() => {
assert.deepEqual(given.dasherize(), expected, description);
}, /String prototype extensions are deprecated/);
}
}

Expand Down
5 changes: 4 additions & 1 deletion packages/@ember/string/tests/decamelize_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import { moduleFor, AbstractTestCase } from 'internal-test-helpers';
function test(assert, given, expected, description) {
assert.deepEqual(decamelize(given), expected, description);
if (ENV.EXTEND_PROTOTYPES.String) {
assert.deepEqual(given.decamelize(), expected, description);
expectDeprecation(() => {
assert.deepEqual(given.decamelize(), expected, description);
}, /String prototype extensions are deprecated/);

}
}

Expand Down
4 changes: 3 additions & 1 deletion packages/@ember/string/tests/underscore_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ import { moduleFor, AbstractTestCase } from 'internal-test-helpers';
function test(assert, given, expected, description) {
assert.deepEqual(underscore(given), expected, description);
if (ENV.EXTEND_PROTOTYPES.String) {
assert.deepEqual(given.underscore(), expected, description);
expectDeprecation(() => {
assert.deepEqual(given.underscore(), expected, description);
}, /String prototype extensions are deprecated/);
}
}

Expand Down
5 changes: 4 additions & 1 deletion packages/@ember/string/tests/w_test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ import { moduleFor, AbstractTestCase } from 'internal-test-helpers';
function test(assert, given, expected, description) {
assert.deepEqual(w(given), expected, description);
if (ENV.EXTEND_PROTOTYPES.String) {
assert.deepEqual(given.w(), expected, description);
expectDeprecation(() => {
assert.deepEqual(given.w(), expected, description);
}, /String prototype extensions are deprecated/);

}
}

Expand Down

0 comments on commit c29007e

Please sign in to comment.