Skip to content

Commit

Permalink
tests: fix ScriptTagService update test
Browse files Browse the repository at this point in the history
Shopify recently made a change that limits all script tags to the `online_store` scope, which caused the `Updates_ScriptTags` test for the ScriptTagService to break. This change fixes the test by updating the script tag's `Src` property instead of the `DisplayScope` property.
  • Loading branch information
nozzlegear committed Feb 28, 2025
1 parent 1a60489 commit 9e6427c
Showing 1 changed file with 8 additions and 6 deletions.
14 changes: 8 additions & 6 deletions ShopifySharp.Tests/ScriptTag_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using FluentAssertions;
using Xunit;
using Xunit.Abstractions;

Expand Down Expand Up @@ -83,19 +84,20 @@ public async Task Creates_ScriptTags()
[Fact]
public async Task Updates_ScriptTags()
{
string newValue = "all";
// Setup
var updatedSrc = ScriptTagTestsFixture.Src + "?ms=" + DateTime.UtcNow.Millisecond;
var created = await Fixture.Create();
long id = created.Id.Value;

created.DisplayScope = newValue;
var id = created.Id!.Value;
created.Src = updatedSrc;
created.Id = null;

// Act
var updated = await Fixture.Service.UpdateAsync(id, created);

// Reset the id so the Fixture can properly delete this object.
created.Id = id;

Assert.Equal(newValue, updated.DisplayScope);
// Assert
updated.Src.Should().Be(updatedSrc);
}
}

Expand Down

0 comments on commit 9e6427c

Please sign in to comment.