@@ -3,6 +3,7 @@ import sinon from 'ts-sinon';
3
3
import { ALL_BUILD_VARIANTS , Config } from './config' ;
4
4
import { uploadArtifactToDownloadCenter as uploadArtifactToDownloadCenterFn } from './download-center' ;
5
5
import { downloadArtifactFromEvergreen as downloadArtifactFromEvergreenFn } from './evergreen' ;
6
+ import { notarizeArtifact as notarizeArtifactFn } from './packaging' ;
6
7
import { generateChangelog as generateChangelogFn } from './git' ;
7
8
import { GithubRepo } from '@mongodb-js/devtools-github-repo' ;
8
9
import { ensureGithubReleaseExistsAndUpdateChangelogFn , runDraft } from './run-draft' ;
@@ -19,12 +20,14 @@ describe('draft', () => {
19
20
let githubRepo : GithubRepo ;
20
21
let uploadArtifactToDownloadCenter : typeof uploadArtifactToDownloadCenterFn ;
21
22
let downloadArtifactFromEvergreen : typeof downloadArtifactFromEvergreenFn ;
23
+ let notarizeArtifact : typeof notarizeArtifactFn ;
22
24
23
25
beforeEach ( ( ) => {
24
26
config = { ...dummyConfig } ;
25
27
26
28
uploadArtifactToDownloadCenter = sinon . spy ( ) ;
27
29
downloadArtifactFromEvergreen = sinon . spy ( ) ;
30
+ notarizeArtifact = sinon . spy ( ) ;
28
31
} ) ;
29
32
30
33
describe ( 'runDraft' , ( ) => {
@@ -49,7 +52,8 @@ describe('draft', () => {
49
52
githubRepo ,
50
53
uploadArtifactToDownloadCenter ,
51
54
downloadArtifactFromEvergreen ,
52
- ensureGithubReleaseExistsAndUpdateChangelog
55
+ ensureGithubReleaseExistsAndUpdateChangelog ,
56
+ notarizeArtifact
53
57
) ;
54
58
} ) ;
55
59
@@ -63,12 +67,16 @@ describe('draft', () => {
63
67
expect ( downloadArtifactFromEvergreen ) . to . have . been . callCount ( ALL_BUILD_VARIANTS . length ) ;
64
68
} ) ;
65
69
70
+ it ( 'asks the notary service to sign files' , ( ) => {
71
+ expect ( notarizeArtifact ) . to . have . been . callCount ( ALL_BUILD_VARIANTS . length ) ;
72
+ } ) ;
73
+
66
74
it ( 'uploads artifacts to download center' , ( ) => {
67
- expect ( uploadArtifactToDownloadCenter ) . to . have . been . callCount ( ALL_BUILD_VARIANTS . length ) ;
75
+ expect ( uploadArtifactToDownloadCenter ) . to . have . been . callCount ( ALL_BUILD_VARIANTS . length * 2 ) ;
68
76
} ) ;
69
77
70
78
it ( 'uploads the artifacts to the github release' , ( ) => {
71
- expect ( uploadReleaseAsset ) . to . have . been . callCount ( ALL_BUILD_VARIANTS . length ) ;
79
+ expect ( uploadReleaseAsset ) . to . have . been . callCount ( ALL_BUILD_VARIANTS . length * 2 ) ;
72
80
} ) ;
73
81
} ) ;
74
82
@@ -83,7 +91,8 @@ describe('draft', () => {
83
91
githubRepo ,
84
92
uploadArtifactToDownloadCenter ,
85
93
downloadArtifactFromEvergreen ,
86
- ensureGithubReleaseExistsAndUpdateChangelog
94
+ ensureGithubReleaseExistsAndUpdateChangelog ,
95
+ notarizeArtifact
87
96
) ;
88
97
expect ( ensureGithubReleaseExistsAndUpdateChangelog ) . to . not . have . been . called ;
89
98
expect ( downloadArtifactFromEvergreen ) . to . not . have . been . called ;
@@ -105,14 +114,16 @@ describe('draft', () => {
105
114
githubRepo ,
106
115
uploadArtifactToDownloadCenter ,
107
116
downloadArtifactFromEvergreen ,
108
- ensureGithubReleaseExistsAndUpdateChangelog
117
+ ensureGithubReleaseExistsAndUpdateChangelog ,
118
+ notarizeArtifact
109
119
) ;
110
120
} catch ( e ) {
111
121
expect ( e . message ) . to . contain ( 'Missing package information from config' ) ;
112
122
expect ( ensureGithubReleaseExistsAndUpdateChangelog ) . to . not . have . been . called ;
113
123
expect ( downloadArtifactFromEvergreen ) . to . not . have . been . called ;
114
124
expect ( uploadArtifactToDownloadCenter ) . to . not . have . been . called ;
115
125
expect ( uploadReleaseAsset ) . to . not . have . been . called ;
126
+ expect ( notarizeArtifact ) . to . not . have . been . called ;
116
127
return ;
117
128
}
118
129
expect . fail ( 'Expected error' ) ;
0 commit comments