File tree Expand file tree Collapse file tree 1 file changed +23
-0
lines changed
Expand file tree Collapse file tree 1 file changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,29 @@ test("sanitizeArtifactName", (t) => {
2424 ) ;
2525} ) ;
2626
27+ test ( "getArtifactSuffix" , ( t ) => {
28+ // No suffix if there's no `matrix` input, it is invalid, or has no keys.
29+ t . is ( debugArtifacts . getArtifactSuffix ( undefined ) , "" ) ;
30+ t . is ( debugArtifacts . getArtifactSuffix ( "" ) , "" ) ;
31+ t . is ( debugArtifacts . getArtifactSuffix ( "invalid json" ) , "" ) ;
32+ t . is ( debugArtifacts . getArtifactSuffix ( "{}" ) , "" ) ;
33+
34+ // Suffixes for non-empty, valid `matrix` inputs.
35+ const testMatrices = [
36+ { language : "go" } ,
37+ { language : "javascript" , "build-mode" : "none" } ,
38+ ] ;
39+
40+ for ( const testMatrix of testMatrices ) {
41+ const suffix = debugArtifacts . getArtifactSuffix ( JSON . stringify ( testMatrix ) ) ;
42+ t . not ( suffix , "" ) ;
43+
44+ for ( const key of Object . keys ( testMatrix ) ) {
45+ t . assert ( suffix . includes ( testMatrix [ key ] as string ) ) ;
46+ }
47+ }
48+ } ) ;
49+
2750// These next tests check the correctness of the logic to determine whether or not
2851// artifacts are uploaded in debug mode. Since it's not easy to mock the actual
2952// call to upload an artifact, we just check that we get an "upload-failed" result,
You can’t perform that action at this time.
0 commit comments