@@ -4,14 +4,16 @@ import { Job } from "./job";
44describe ( "Job" , ( ) => {
55 test . each < [ Job , Record < string , unknown > ] > ( [
66 [
7- new Job ( "test" , { runsOn : "ubuntu-latest" } ) . run ( "echo 'Hello, world!'" ) ,
7+ new Job ( "simple-job" , { runsOn : "ubuntu-latest" } ) . run (
8+ "echo 'Hello, world!'" ,
9+ ) ,
810 {
911 "runs-on" : "ubuntu-latest" ,
1012 steps : [ { run : "echo 'Hello, world!'" } ] ,
1113 } ,
1214 ] ,
1315 [
14- new Job ( "test " , {
16+ new Job ( "with-permissions " , {
1517 runsOn : "ubuntu-latest" ,
1618 permissions : {
1719 contents : "read" ,
@@ -28,7 +30,7 @@ describe("Job", () => {
2830 } ,
2931 ] ,
3032 [
31- new Job ( "test " , {
33+ new Job ( "with-timeout-minutes " , {
3234 runsOn : "ubuntu-latest" ,
3335 timeoutMinutes : 10 ,
3436 } ) ,
@@ -39,7 +41,7 @@ describe("Job", () => {
3941 } ,
4042 ] ,
4143 [
42- new Job ( "test " , {
44+ new Job ( "with-timeout-minutes " , {
4345 runsOn : "ubuntu-latest" ,
4446 timeoutMinutes : "${{ foo }}" ,
4547 } ) ,
@@ -50,7 +52,7 @@ describe("Job", () => {
5052 } ,
5153 ] ,
5254 [
53- new Job ( "test " , {
55+ new Job ( "with-outputs " , {
5456 runsOn : "ubuntu-latest" ,
5557 outputs : {
5658 "output-name" : "output-value" ,
@@ -63,7 +65,7 @@ describe("Job", () => {
6365 } ,
6466 ] ,
6567 [
66- new Job ( "test " , {
68+ new Job ( "with-needs " , {
6769 runsOn : "ubuntu-latest" ,
6870 needs : "job-name" ,
6971 } ) . run ( "echo 'Hello, world!'" ) ,
@@ -74,7 +76,7 @@ describe("Job", () => {
7476 } ,
7577 ] ,
7678 [
77- new Job ( "test " , {
79+ new Job ( "with-if " , {
7880 runsOn : "ubuntu-latest" ,
7981 if : "always()" ,
8082 } ) . run ( "echo 'Hello, world!'" ) ,
@@ -85,7 +87,7 @@ describe("Job", () => {
8587 } ,
8688 ] ,
8789 [
88- new Job ( "test " , {
90+ new Job ( "with-concurrency " , {
8991 runsOn : "ubuntu-latest" ,
9092 concurrency : "group-name" ,
9193 } ) . run ( "echo 'Hello, world!'" ) ,
@@ -96,7 +98,7 @@ describe("Job", () => {
9698 } ,
9799 ] ,
98100 [
99- new Job ( "test " , {
101+ new Job ( "with-concurrency " , {
100102 runsOn : "ubuntu-latest" ,
101103 concurrency : { group : "group-name" , cancelInProgress : true } ,
102104 } ) . run ( "echo 'Hello, world!'" ) ,
@@ -106,6 +108,17 @@ describe("Job", () => {
106108 steps : [ { run : "echo 'Hello, world!'" } ] ,
107109 } ,
108110 ] ,
111+ [
112+ new Job ( "with-defaults" , {
113+ runsOn : "ubuntu-latest" ,
114+ defaults : { run : { shell : "bash" } } ,
115+ } ) . run ( "echo 'Hello, world!'" ) ,
116+ {
117+ "runs-on" : "ubuntu-latest" ,
118+ defaults : { run : { shell : "bash" } } ,
119+ steps : [ { run : "echo 'Hello, world!'" } ] ,
120+ } ,
121+ ] ,
109122 ] ) ( "job.toJSON(%j) -> %j" , ( job , expected ) => {
110123 expect ( job . toJSON ( ) ) . toEqual ( expected ) ;
111124 } ) ;
0 commit comments