Skip to content

Commit

Permalink
test: remove duplicated code.
Browse files Browse the repository at this point in the history
  • Loading branch information
gmodena committed Oct 13, 2024
1 parent ca057f1 commit 5711e48
Showing 1 changed file with 13 additions and 22 deletions.
35 changes: 13 additions & 22 deletions tests/ref-test.nix
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,17 @@ let
pwd = builtins.getEnv "PWD";
fixturePath = "file://${pwd}/fixtures/package.flatpakref";
fixtureHash = "040iig2yg2i28s5xc9cvp5syaaqq165idy3nhlpv8xn4f6zh4h1f";
expectedFixtureAttrSet = {
${ref.sanitizeUrl fixturePath} = {
Title = "gedit";
Name = "org.gnome.gedit";
Branch = "stable";
Url = "http://sdk.gnome.org/repo-apps/";
IsRuntime = "false";
GPGKey = "REDACTED";
DeployCollectionID = "org.gnome.Apps";
};
};
in
runTests {
testSanitizeUrl = {
Expand Down Expand Up @@ -47,31 +58,11 @@ runTests {

testFlatpakrefToAttrSet = {
expr = ref.flatpakrefToAttrSet { flatpakref = fixturePath; sha256 = null; } { };
expected = {
${ref.sanitizeUrl fixturePath} = {
Title = "gedit";
Name = "org.gnome.gedit";
Branch = "stable";
Url = "http://sdk.gnome.org/repo-apps/";
IsRuntime = "false";
GPGKey = "REDACTED";
DeployCollectionID = "org.gnome.Apps";
};
};
expected = expectedFixtureAttrSet;
};

testFlatpakrefToAttrSetWithSha256 = {
expr = ref.flatpakrefToAttrSet { flatpakref = fixturePath; sha256 = fixtureHash; } { };
expected = {
${ref.sanitizeUrl fixturePath} = {
Title = "gedit";
Name = "org.gnome.gedit";
Branch = "stable";
Url = "http://sdk.gnome.org/repo-apps/";
IsRuntime = "false";
GPGKey = "REDACTED";
DeployCollectionID = "org.gnome.Apps";
};
};
expected = expectedFixtureAttrSet;
};
}

0 comments on commit 5711e48

Please sign in to comment.