File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -45,15 +45,24 @@ defmodule NPM.PlatformOptionalTest do
4545 :ets . insert ( :npm_resolver_cache , { "@oxfmt/binding-darwin-arm64" , darwin } )
4646 :ets . insert ( :npm_resolver_cache , { "@oxfmt/binding-linux-x64-gnu" , linux } )
4747
48+ { expected_name , other_name } =
49+ case :os . type ( ) do
50+ { :unix , :darwin } ->
51+ { "@oxfmt/binding-darwin-arm64" , "@oxfmt/binding-linux-x64-gnu" }
52+
53+ { :unix , :linux } ->
54+ { "@oxfmt/binding-linux-x64-gnu" , "@oxfmt/binding-darwin-arm64" }
55+ end
56+
4857 selected =
4958 NPM.PlatformOptional . select ( % {
5059 "@oxfmt/binding-darwin-arm64" => "0.37.0" ,
5160 "@oxfmt/binding-linux-x64-gnu" => "0.37.0"
5261 } )
5362
54- assert selected == % { "@oxfmt/binding-darwin-arm64" => "0.37.0" }
55- assert NPM.PlatformOptional . current_match ( "@oxfmt/binding-darwin-arm64" )
56- refute NPM.PlatformOptional . current_match ( "@oxfmt/binding-linux-x64-gnu" )
63+ assert selected == % { expected_name => "0.37.0" }
64+ assert NPM.PlatformOptional . current_match ( expected_name )
65+ refute NPM.PlatformOptional . current_match ( other_name )
5766 after
5867 NPM.Resolver . clear_cache ( )
5968 end
You can’t perform that action at this time.
0 commit comments