From ae57cf546017b6216cc550c4fb464946b0b263af Mon Sep 17 00:00:00 2001 From: eth3lbert Date: Fri, 13 Dec 2024 16:20:26 +0800 Subject: [PATCH] tests/components/crate-sidebar: Use the native array method `[0]` This fixes the following deprecations: - The `firstObject` method on the class ManyArray is deprecated. --- tests/components/crate-sidebar/playground-button-test.js | 8 ++++---- tests/components/crate-sidebar/toml-snippet-test.js | 6 +++--- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/tests/components/crate-sidebar/playground-button-test.js b/tests/components/crate-sidebar/playground-button-test.js index b088098e79..48f7207d30 100644 --- a/tests/components/crate-sidebar/playground-button-test.js +++ b/tests/components/crate-sidebar/playground-button-test.js @@ -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``); @@ -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 = @@ -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``); @@ -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``); diff --git a/tests/components/crate-sidebar/toml-snippet-test.js b/tests/components/crate-sidebar/toml-snippet-test.js index 87a2c96e37..33cb47ae65 100644 --- a/tests/components/crate-sidebar/toml-snippet-test.js +++ b/tests/components/crate-sidebar/toml-snippet-test.js @@ -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``); @@ -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``); @@ -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``);