Compare commits
2 commits
1995b38510
...
79f3203f70
Author | SHA1 | Date | |
---|---|---|---|
79f3203f70 | |||
e8a2ec52a6 |
3 changed files with 137 additions and 6 deletions
|
@ -26,6 +26,7 @@ export default class GitProvider {
|
||||||
|
|
||||||
for (let asset of item.assets) {
|
for (let asset of item.assets) {
|
||||||
if (!asset.name.endsWith('-sc.7z')) continue
|
if (!asset.name.endsWith('-sc.7z')) continue
|
||||||
|
if (this.config.git_required_prefix && !asset.name.startsWith(this.config.git_required_prefix)) continue
|
||||||
|
|
||||||
return {
|
return {
|
||||||
version: item.name,
|
version: item.name,
|
||||||
|
|
|
@ -314,12 +314,13 @@ runners.forEach(function([runnerName, appname]) {
|
||||||
|
|
||||||
let secondLast = parseLine(logs[logs.length - 2])
|
let secondLast = parseLine(logs[logs.length - 2])
|
||||||
let last = parseLine(logs[logs.length - 1])
|
let last = parseLine(logs[logs.length - 1])
|
||||||
assert.match(secondLast.msg, /creating/i)
|
assert.match(secondLast.msg, /No/i)
|
||||||
assert.match(secondLast.msg, /application/i)
|
assert.match(secondLast.msg, /versions/i)
|
||||||
assert.match(secondLast.msg, /testapp/i)
|
assert.match(secondLast.msg, /found/i)
|
||||||
assert.match(secondLast.msg, /0 releases/i)
|
assert.match(last.msg, /starting/i)
|
||||||
assert.match(last.err.message, /none/i)
|
assert.match(last.msg, /runner/i)
|
||||||
assert.match(last.err.message, /successful/i)
|
assert.match(last.err.message, /stable/i)
|
||||||
|
assert.match(last.err.message, /application/i)
|
||||||
|
|
||||||
// Reset our log
|
// Reset our log
|
||||||
logs.splice(0, logs.length); logIndex = 0; logWaitIndex = 0;
|
logs.splice(0, logs.length); logIndex = 0; logWaitIndex = 0;
|
||||||
|
|
|
@ -108,6 +108,135 @@ t.describe('#getLatestVersion()', function() {
|
||||||
assert.match(err.message, /found/)
|
assert.match(err.message, /found/)
|
||||||
})
|
})
|
||||||
|
|
||||||
|
// --
|
||||||
|
|
||||||
|
|
||||||
|
t.test('should return correct name and link in result when git_required_prefix is specified', async function() {
|
||||||
|
const assertName = 'Karen'
|
||||||
|
const assertLink = 'Over The Future'
|
||||||
|
const assertFilename = 'gittest_test-sc.7z'
|
||||||
|
let stubber = stub()
|
||||||
|
let provider = new GitProvider({ git_required_prefix: 'gittest' }, stubber)
|
||||||
|
|
||||||
|
stubber.resolves({ body: [
|
||||||
|
{ name: assertName, assets: [{ name: assertFilename, browser_download_url: assertLink }] },
|
||||||
|
]})
|
||||||
|
|
||||||
|
let version = await provider.getLatestVersion()
|
||||||
|
assert.strictEqual(version.version, assertName)
|
||||||
|
assert.strictEqual(version.link, assertLink)
|
||||||
|
assert.strictEqual(version.filename, assertFilename)
|
||||||
|
assert.strictEqual(version.log, '')
|
||||||
|
})
|
||||||
|
|
||||||
|
t.test('should skip zip files for now even when git_required_prefix is specified', async function() {
|
||||||
|
const assertName = 'Karen'
|
||||||
|
const assertLink = 'My Wings'
|
||||||
|
const assertFilename = 'gittest_test-sc.zip'
|
||||||
|
let stubber = stub()
|
||||||
|
let provider = new GitProvider({ git_required_prefix: 'gittest' }, stubber)
|
||||||
|
|
||||||
|
stubber.resolves({ body: [
|
||||||
|
{ name: assertName, assets: [{ name: assertFilename, browser_download_url: assertLink }] },
|
||||||
|
]})
|
||||||
|
|
||||||
|
let err = await assert.isRejected(provider.getLatestVersion())
|
||||||
|
assert.match(err.message, /release/)
|
||||||
|
assert.match(err.message, /found/)
|
||||||
|
})
|
||||||
|
|
||||||
|
t.test('should skip versions with missing git_required_prefix prefix', async function() {
|
||||||
|
const assertName = 'name1'
|
||||||
|
const assertLink = 'somelink'
|
||||||
|
const assertFilename = 'gittest_something-sc.7z'
|
||||||
|
let stubber = stub()
|
||||||
|
let provider = new GitProvider({ git_required_prefix: 'gittest' }, stubber)
|
||||||
|
|
||||||
|
stubber.resolves({ body: [
|
||||||
|
{ name: 'test', assets: [] },
|
||||||
|
{ name: assertName, assets: [{ name: 'something-sc.7z', browser_download_url: 'nope' }] },
|
||||||
|
{ name: assertName, assets: [{ name: assertFilename, browser_download_url: assertLink }] },
|
||||||
|
]})
|
||||||
|
|
||||||
|
let version = await provider.getLatestVersion()
|
||||||
|
assert.strictEqual(version.version, assertName)
|
||||||
|
assert.strictEqual(version.link, assertLink)
|
||||||
|
assert.strictEqual(version.filename, assertFilename)
|
||||||
|
})
|
||||||
|
|
||||||
|
t.test('should skip versions with non-sc, non-git_required_prefix filename', async function() {
|
||||||
|
const assertName = 'name2'
|
||||||
|
const assertLink = 'somelink2'
|
||||||
|
const assertFilename = 'gittest_something-sc.7z'
|
||||||
|
let stubber = stub()
|
||||||
|
let provider = new GitProvider({ git_required_prefix: 'gittest' }, stubber)
|
||||||
|
|
||||||
|
stubber.resolves({ body: [
|
||||||
|
{ name: 'test', assets: [{ name: 'nope.7z', browser_download_url: 'nope' }] },
|
||||||
|
{ name: 'test', assets: [{ name: 'gittest_nope.7z', browser_download_url: 'nope' }] },
|
||||||
|
{ name: assertName, assets: [{ name: assertFilename, browser_download_url: assertLink }] },
|
||||||
|
]})
|
||||||
|
|
||||||
|
let version = await provider.getLatestVersion()
|
||||||
|
assert.strictEqual(version.version, assertName)
|
||||||
|
assert.strictEqual(version.link, assertLink)
|
||||||
|
assert.strictEqual(version.filename, assertFilename)
|
||||||
|
})
|
||||||
|
|
||||||
|
t.test('should skip assets with non-sc filename and non-git_required_prefix', async function() {
|
||||||
|
const assertName = 'name3'
|
||||||
|
const assertLink = 'somelink3'
|
||||||
|
const assertFilename = 'gittest_something-sc.7z'
|
||||||
|
let stubber = stub()
|
||||||
|
let provider = new GitProvider({ git_required_prefix: 'gittest' }, stubber)
|
||||||
|
|
||||||
|
stubber.resolves({ body: [
|
||||||
|
{ name: 'test', assets: [{ name: 'gittest_nope.7z', browser_download_url: 'nope' }] },
|
||||||
|
{ name: assertName, assets: [
|
||||||
|
{ name: 'nope.7z', browser_download_url: 'nope' },
|
||||||
|
{ name: 'gittest_nope.7z', browser_download_url: 'nope' },
|
||||||
|
{ name: 'something-sc.7z', browser_download_url: 'nope' },
|
||||||
|
{ name: assertFilename, browser_download_url: assertLink },
|
||||||
|
] },
|
||||||
|
]})
|
||||||
|
|
||||||
|
let version = await provider.getLatestVersion()
|
||||||
|
assert.strictEqual(version.version, assertName)
|
||||||
|
assert.strictEqual(version.link, assertLink)
|
||||||
|
assert.strictEqual(version.filename, assertFilename)
|
||||||
|
})
|
||||||
|
|
||||||
|
t.test('should otherwise reject non-git_required_prefix files', async function() {
|
||||||
|
let stubber = stub()
|
||||||
|
let provider = new GitProvider({ git_required_prefix: 'gittest' }, stubber)
|
||||||
|
|
||||||
|
stubber.resolves({ body: [
|
||||||
|
{ name: 'test', assets: [{ name: 'nope.7z', browser_download_url: 'nope' }] },
|
||||||
|
{ name: 'test2', assets: [{ name: 'nope2.7z', browser_download_url: 'nope' },] },
|
||||||
|
{ name: 'test3', assets: [{ name: 'nope2.7z', browser_download_url: 'nope' },] },
|
||||||
|
{ name: 'test3', assets: [{ name: 'something-sc.7z', browser_download_url: 'nope' },] },
|
||||||
|
]})
|
||||||
|
|
||||||
|
let err = await assert.isRejected(provider.getLatestVersion())
|
||||||
|
assert.match(err.message, /release/)
|
||||||
|
assert.match(err.message, /found/)
|
||||||
|
})
|
||||||
|
|
||||||
|
t.test('should otherwise reject', async function() {
|
||||||
|
let stubber = stub()
|
||||||
|
let provider = new GitProvider({}, stubber)
|
||||||
|
|
||||||
|
stubber.resolves({ body: [
|
||||||
|
{ name: 'test', assets: [{ name: 'nope.7z', browser_download_url: 'nope' }] },
|
||||||
|
{ name: 'test2', assets: [{ name: 'nope2.7z', browser_download_url: 'nope' },] },
|
||||||
|
{ name: 'test3', assets: [{ name: 'nope2.7z', browser_download_url: 'nope' },] },
|
||||||
|
]})
|
||||||
|
|
||||||
|
let err = await assert.isRejected(provider.getLatestVersion())
|
||||||
|
assert.match(err.message, /release/)
|
||||||
|
assert.match(err.message, /found/)
|
||||||
|
})
|
||||||
|
|
||||||
t.test('should reject if not valid body', async function() {
|
t.test('should reject if not valid body', async function() {
|
||||||
let provider = new GitProvider({}, stub())
|
let provider = new GitProvider({}, stub())
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue