提交 31854ec2 编写于 作者: 杜庆泉's avatar 杜庆泉

修復部分报警

上级 675c311f
...@@ -41,7 +41,7 @@ export function testArray(): Result { ...@@ -41,7 +41,7 @@ export function testArray(): Result {
}) })
test('length', () => { test('length', () => {
const arr: string[] = ['shoes', 'shirts', 'socks', 'sweaters']; const arr = ['shoes', 'shirts', 'socks', 'sweaters'];
expect(arr.length).toEqual(4); expect(arr.length).toEqual(4);
expect(arr[0]).toEqual('shoes'); expect(arr[0]).toEqual('shoes');
expect(arr[1]).toEqual('shirts'); expect(arr[1]).toEqual('shirts');
...@@ -65,17 +65,17 @@ export function testArray(): Result { ...@@ -65,17 +65,17 @@ export function testArray(): Result {
expect(['a', 'b', 'c'].concat(['d', 'e', 'f'])).toEqual(["a", "b", "c", "d", "e", "f"]); expect(['a', 'b', 'c'].concat(['d', 'e', 'f'])).toEqual(["a", "b", "c", "d", "e", "f"]);
expect([1, 2, 3].concat([4, 5, 6])).toEqual([1, 2, 3, 4, 5, 6]); expect([1, 2, 3].concat([4, 5, 6])).toEqual([1, 2, 3, 4, 5, 6]);
expect([''].concat([''])).toEqual(["", ""]); expect([''].concat([''])).toEqual(["", ""]);
const num1: number[] = [1, 2, 3]; const num1 = [1, 2, 3];
const num2: number[] = [4, 5, 6]; const num2 = [4, 5, 6];
const num3: number[] = [7, 8, 9]; const num3 = [7, 8, 9];
const numbers = num1.concat(num2, num3); const numbers = num1.concat(num2, num3);
expect(numbers).toEqual([1, 2, 3, 4, 5, 6, 7, 8, 9]); expect(numbers).toEqual([1, 2, 3, 4, 5, 6, 7, 8, 9]);
}) })
test("copyWithin", () => { test("copyWithin", () => {
const arr: string[] = ['a', 'b', 'c', 'd', 'e']; const arr = ['a', 'b', 'c', 'd', 'e'];
expect(arr.copyWithin(0, 3, 4)).toEqual(["d", "b", "c", "d", "e"]); expect(arr.copyWithin(0, 3, 4)).toEqual(["d", "b", "c", "d", "e"]);
expect(arr.copyWithin(1, 3)).toEqual(["d", "d", "e", "d", "e"]); expect(arr.copyWithin(1, 3)).toEqual(["d", "d", "e", "d", "e"]);
const arr2: number[] = [1, 2, 3, 4, 5]; const arr2 = [1, 2, 3, 4, 5];
expect(arr2.copyWithin(-2)).toEqual([1, 2, 3, 1, 2]); expect(arr2.copyWithin(-2)).toEqual([1, 2, 3, 1, 2]);
expect(arr2.copyWithin(-2, -3, -1)).toEqual([1, 2, 3, 3, 1]); expect(arr2.copyWithin(-2, -3, -1)).toEqual([1, 2, 3, 3, 1]);
}) })
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册