-
Notifications
You must be signed in to change notification settings - Fork 1.2k
/
Copy pathtrimStart_trimEnd.js
53 lines (47 loc) · 2.37 KB
/
trimStart_trimEnd.js
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
//-------------------------------------------------------------------------------------------------------
// Copyright (C) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE.txt file in the project root for full license information.
//-------------------------------------------------------------------------------------------------------
WScript.LoadScriptFile("../UnitTestFramework/UnitTestFramework.js");
const tests = [
{
name: "trimLeft is same function as trimStart",
body: function () {
// NOTE: See comments in test/UnitTestFramework/UnitTestFramework.js for more info about what assertions you can use
assert.areEqual(String.prototype.trimLeft, String.prototype.trimStart, "Both trimStart and trimLeft should point to the same function");
}
},
{
name: "trimRight is same function as trimEnd",
body: function () {
assert.areEqual(String.prototype.trimRight, String.prototype.trimEnd, "Both trimRight and trimEnd should point to the same function");
}
},
{
name: "String.prototype.trimLeft.name is changed",
body: function () {
assert.areEqual(String.prototype.trimLeft.name, 'trimStart', "String.prototype.trimLeft.name should be named trimStart");
}
},
{
name: "String.prototype.trimRight.name is changed",
body: function () {
assert.areEqual(String.prototype.trimRight.name, 'trimEnd', "String.prototype.trimRight.name should be named trimEnd");
}
},
{
name: "String.prototype.trimStart.name is consistent",
body: function () {
assert.areEqual(String.prototype.trimStart.name, 'trimStart', "String.prototype.trimLeft.name should be named trimStart");
}
},
{
name: "String.prototype.trimEnd.name is changed",
body: function () {
assert.areEqual(String.prototype.trimEnd.name, 'trimEnd', "String.prototype.trimEnd.name should be named trimEnd");
}
}
];
// The test runner will pass "-args summary -endargs" to ch, so that "summary" appears as argument [0[] to the script,
// and the following line will then ensure that the test will only display summary output (i.e. "PASS").
testRunner.runTests(tests, { verbose: WScript.Arguments[0] != "summary" });