Skip to content

Commit 5ce375a

Browse files
committed
CONT-1219 : Adding test cases
1 parent 07297dc commit 5ce375a

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

__tests__/github.test.ts

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,6 +171,46 @@ describe('With a new github client', () => {
171171
})
172172
})
173173

174+
describe('With a new github client without label', () => {
175+
let client: GitHubClient
176+
177+
beforeAll(() => {
178+
process.env['GITHUB_PATH'] = ''
179+
180+
Object.defineProperty(github, 'context', {
181+
value: {
182+
eventName: 'issues',
183+
repo: {
184+
owner: 'puppetlabs',
185+
repo: 'iac'
186+
},
187+
issue: {
188+
number: 331
189+
},
190+
payload: {
191+
action: 'opened',
192+
sender: {
193+
login: 'dependabot[bot]'
194+
},
195+
issue: {
196+
labels: [
197+
]
198+
}
199+
}
200+
}
201+
})
202+
203+
client = new GitHubClient('1234')
204+
console.log('::stop-commands::stoptoken')
205+
process.stdout.write = jest.fn()
206+
})
207+
208+
test('getLabels returns false if the label does not exist on the issue or pr', () => {
209+
const result = client.getLabels()
210+
expect(result).toBe(false)
211+
})
212+
})
213+
174214
describe('With an invalid event in the payload', () => {
175215
beforeAll(() => {
176216
Object.defineProperty(github, 'context', {

0 commit comments

Comments
 (0)