Skip to content

Commit

Permalink
misc: fix Updates_Assets test by adding small 2-second delay
Browse files Browse the repository at this point in the history
  • Loading branch information
nozzlegear committed Jul 3, 2024
1 parent 4eebc0f commit e1966ae
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions ShopifySharp.Tests/Asset_Tests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
using System.Linq;
using System.Net;
using System.Threading.Tasks;
using ShopifySharp.Infrastructure;
using Xunit;
using Xunit.Abstractions;

Expand Down Expand Up @@ -40,12 +39,14 @@ public async Task Creates_Assets()
[Fact]
public async Task Updates_Assets()
{
string key = "templates/update-test.liquid";
string newValue = "<h1>Hello, world! I've been updated!</h1>";
var key = "snippets/update-test.liquid";
var newValue = "<h1>Hello, world! I've been updated!</h1>";
var created = await Fixture.Create(key);
created.Value = newValue;

await Fixture.Service.CreateOrUpdateAsync(Fixture.ThemeId, created);
// In 2024-07, there seems to be a small delay between when an asset is updated and when the new value is available
await Task.Delay(TimeSpan.FromSeconds(2));

// Value is not returned when creating or updating. Must get the asset to check it.
var updated = await Fixture.Service.GetAsync(Fixture.ThemeId, key);
Expand Down

0 comments on commit e1966ae

Please sign in to comment.