This repository has been archived by the owner on Apr 12, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
/
test.js
54 lines (48 loc) · 1.5 KB
/
test.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
require('chai').should()
const {before, describe, it} = require('mocha')
const ghauth = require('ghauth')
const GitHub = require('github')
const pkg = require('./package.json')
const filenames = require('./lib/filenames')
const authOptions = {
configName: pkg.name,
note: pkg.description,
scopes: ['repo']
}
let releases
let drafts
let draft
describe('electron-prelease-check', () => {
before(function(done) {
this.timeout(90 * 1000) // allow plenty of time to log in
ghauth(authOptions, function (err, authData) {
const github = new GitHub()
github.authenticate({type: 'token', token: authData.token})
github.repos.getReleases({owner: 'electron', repo: 'electron'})
.then(res => {
releases = res.data
done()
})
})
})
it('only one draft exists', () => {
drafts = releases.filter(release => release.draft)
drafts.length.should.equal(1)
draft = drafts[0]
})
it('draft is a prerelease', () => {
draft.prerelease.should.equal(true)
})
it('draft has release notes', () => {
draft.body.should.not.include('placeholder')
draft.body.length.should.be.above(50)
})
it('draft has all required assets', () => {
const requiredAssets = filenames(draft.tag_name).sort()
const extantAssets = draft.assets.map(asset => asset.name).sort()
requiredAssets.length.should.be.above(28)
requiredAssets.forEach(asset => {
extantAssets.should.include(asset, `${asset} not found in release assets`)
})
})
})