@@ -425,10 +425,10 @@ ruleTester.run('no-get', rule, {
425425 ] ,
426426 } ,
427427 {
428- // Handle array element access with optional chaining.
429- code : "this.get('foo1.0. bar1bar.1 ')" ,
428+ // Handle array element access with optional chaining (beginning/middle/end of string) .
429+ code : "this.get('0. foo1.1.2. bar1bar.3 ')" ,
430430 options : [ { useOptionalChaining : true } ] ,
431- output : 'this.foo1?.[0 ]?.bar1bar?.[1 ]' ,
431+ output : 'this[0]? .foo1?.[1 ]?.[2]?. bar1bar?.[3 ]' ,
432432 errors : [
433433 {
434434 message : ERROR_MESSAGE_GET ,
@@ -437,10 +437,10 @@ ruleTester.run('no-get', rule, {
437437 ] ,
438438 } ,
439439 {
440- // Handle array element access at beginning of string, with optional chaining .
441- code : "this.get('0.foo ')" ,
440+ // Handle array element access as entire string.
441+ code : "this.get('0')" ,
442442 options : [ { useOptionalChaining : true } ] ,
443- output : 'this[0]?.foo ' ,
443+ output : 'this[0]' ,
444444 errors : [
445445 {
446446 message : ERROR_MESSAGE_GET ,
@@ -449,9 +449,20 @@ ruleTester.run('no-get', rule, {
449449 ] ,
450450 } ,
451451 {
452- // Handle array element access (left side of an assignment).
453- code : "this.get('foo.0.bar')[123] = 'hello world';" ,
454- output : "this.foo[0].bar[123] = 'hello world';" ,
452+ // Handle array element access (left side of an assignment, beginning/middle/end of string).
453+ code : "this.get('0.foo.1.bar.2')[123] = 'hello world';" ,
454+ output : "this[0].foo[1].bar[2][123] = 'hello world';" ,
455+ errors : [
456+ {
457+ message : ERROR_MESSAGE_GET ,
458+ type : 'CallExpression' ,
459+ } ,
460+ ] ,
461+ } ,
462+ {
463+ // Handle array element access (left side of an assignment, entire string).
464+ code : "this.get('0')[123] = 'hello world';" ,
465+ output : "this[0][123] = 'hello world';" ,
455466 errors : [
456467 {
457468 message : ERROR_MESSAGE_GET ,
0 commit comments