Skip to content

Commit ac1a774

Browse files
committed
tests/components/crate-sidebar: Use the native array method [0]
This fixes the following deprecations: - The `firstObject` method on the class ManyArray is deprecated.
1 parent 9538b22 commit ac1a774

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

tests/components/crate-sidebar/playground-button-test.js

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ module('Component | CrateSidebar | Playground Button', function (hooks) {
3333

3434
let store = this.owner.lookup('service:store');
3535
this.crate = await store.findRecord('crate', crate.name);
36-
this.version = (await this.crate.versions).firstObject;
36+
this.version = (await this.crate.versions).slice()[0];
3737
await this.crate.loadOwnersTask.perform();
3838

3939
await render(hbs`<CrateSidebar @crate={{this.crate}} @version={{this.version}} />`);
@@ -46,7 +46,7 @@ module('Component | CrateSidebar | Playground Button', function (hooks) {
4646

4747
let store = this.owner.lookup('service:store');
4848
this.crate = await store.findRecord('crate', crate.name);
49-
this.version = (await this.crate.versions).firstObject;
49+
this.version = (await this.crate.versions).slice()[0];
5050
await this.crate.loadOwnersTask.perform();
5151

5252
let expectedHref =
@@ -65,7 +65,7 @@ module('Component | CrateSidebar | Playground Button', function (hooks) {
6565

6666
let store = this.owner.lookup('service:store');
6767
this.crate = await store.findRecord('crate', crate.name);
68-
this.version = (await this.crate.versions).firstObject;
68+
this.version = (await this.crate.versions).slice()[0];
6969
await this.crate.loadOwnersTask.perform();
7070

7171
render(hbs`<CrateSidebar @crate={{this.crate}} @version={{this.version}} />`);
@@ -84,7 +84,7 @@ module('Component | CrateSidebar | Playground Button', function (hooks) {
8484

8585
let store = this.owner.lookup('service:store');
8686
this.crate = await store.findRecord('crate', crate.name);
87-
this.version = (await this.crate.versions).firstObject;
87+
this.version = (await this.crate.versions).slice()[0];
8888
await this.crate.loadOwnersTask.perform();
8989

9090
await render(hbs`<CrateSidebar @crate={{this.crate}} @version={{this.version}} />`);

tests/components/crate-sidebar/toml-snippet-test.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ module('Component | CrateSidebar | toml snippet', function (hooks) {
1717

1818
let store = this.owner.lookup('service:store');
1919
this.crate = await store.findRecord('crate', crate.name);
20-
this.version = (await this.crate.versions).firstObject;
20+
this.version = (await this.crate.versions).slice()[0];
2121
await this.crate.loadOwnersTask.perform();
2222

2323
await render(hbs`<CrateSidebar @crate={{this.crate}} @version={{this.version}} />`);
@@ -35,7 +35,7 @@ module('Component | CrateSidebar | toml snippet', function (hooks) {
3535

3636
let store = this.owner.lookup('service:store');
3737
this.crate = await store.findRecord('crate', crate.name);
38-
this.version = (await this.crate.versions).firstObject;
38+
this.version = (await this.crate.versions).slice()[0];
3939
await this.crate.loadOwnersTask.perform();
4040

4141
await render(hbs`<CrateSidebar @crate={{this.crate}} @version={{this.version}} />`);
@@ -48,7 +48,7 @@ module('Component | CrateSidebar | toml snippet', function (hooks) {
4848

4949
let store = this.owner.lookup('service:store');
5050
this.crate = await store.findRecord('crate', crate.name);
51-
this.version = (await this.crate.versions).firstObject;
51+
this.version = (await this.crate.versions).slice()[0];
5252
await this.crate.loadOwnersTask.perform();
5353

5454
await render(hbs`<CrateSidebar @crate={{this.crate}} @version={{this.version}} />`);

0 commit comments

Comments
 (0)