Skip to content

Commit

Permalink
tests/components/crate-sidebar: Use the native array method [0]
Browse files Browse the repository at this point in the history
This fixes the following deprecations:
- The `firstObject` method on the class ManyArray is deprecated.
  • Loading branch information
eth3lbert committed Dec 15, 2024
1 parent 9538b22 commit ac1a774
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 4 additions & 4 deletions tests/components/crate-sidebar/playground-button-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ module('Component | CrateSidebar | Playground Button', function (hooks) {

let store = this.owner.lookup('service:store');
this.crate = await store.findRecord('crate', crate.name);
this.version = (await this.crate.versions).firstObject;
this.version = (await this.crate.versions).slice()[0];
await this.crate.loadOwnersTask.perform();

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

let store = this.owner.lookup('service:store');
this.crate = await store.findRecord('crate', crate.name);
this.version = (await this.crate.versions).firstObject;
this.version = (await this.crate.versions).slice()[0];
await this.crate.loadOwnersTask.perform();

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

let store = this.owner.lookup('service:store');
this.crate = await store.findRecord('crate', crate.name);
this.version = (await this.crate.versions).firstObject;
this.version = (await this.crate.versions).slice()[0];
await this.crate.loadOwnersTask.perform();

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

let store = this.owner.lookup('service:store');
this.crate = await store.findRecord('crate', crate.name);
this.version = (await this.crate.versions).firstObject;
this.version = (await this.crate.versions).slice()[0];
await this.crate.loadOwnersTask.perform();

await render(hbs`<CrateSidebar @crate={{this.crate}} @version={{this.version}} />`);
Expand Down
6 changes: 3 additions & 3 deletions tests/components/crate-sidebar/toml-snippet-test.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ module('Component | CrateSidebar | toml snippet', function (hooks) {

let store = this.owner.lookup('service:store');
this.crate = await store.findRecord('crate', crate.name);
this.version = (await this.crate.versions).firstObject;
this.version = (await this.crate.versions).slice()[0];
await this.crate.loadOwnersTask.perform();

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

let store = this.owner.lookup('service:store');
this.crate = await store.findRecord('crate', crate.name);
this.version = (await this.crate.versions).firstObject;
this.version = (await this.crate.versions).slice()[0];
await this.crate.loadOwnersTask.perform();

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

let store = this.owner.lookup('service:store');
this.crate = await store.findRecord('crate', crate.name);
this.version = (await this.crate.versions).firstObject;
this.version = (await this.crate.versions).slice()[0];
await this.crate.loadOwnersTask.perform();

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

0 comments on commit ac1a774

Please sign in to comment.