Skip to content

Commit

Permalink
chore: Adding allowPrerelease github integration tests (#7003)
Browse files Browse the repository at this point in the history
  • Loading branch information
mmaietta authored Jul 16, 2022
1 parent d6115bc commit c0be3e5
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 0 deletions.
38 changes: 38 additions & 0 deletions test/snapshots/updater/nsisUpdaterTest.js.snap
Original file line number Diff line number Diff line change
Expand Up @@ -401,6 +401,44 @@ Array [
]
`;

exports[`github allowPrerelease=false 1`] = `
Object {
"files": Array [
Object {
"sha512": "@sha512",
"size": "@size",
"url": "electron-quick-start-typescript-1.0.2-arm64.exe",
},
],
"path": "electron-quick-start-typescript-1.0.2-arm64.exe",
"releaseDate": "@releaseDate",
"releaseName": "1.0.2",
"releaseNotes": "",
"sha512": "@sha512",
"tag": "v1.0.2",
"version": "1.0.2",
}
`;

exports[`github allowPrerelease=true 1`] = `
Object {
"files": Array [
Object {
"sha512": "@sha512",
"size": "@size",
"url": "electron-quick-start-typescript-2.0.0-arm64.exe",
},
],
"path": "electron-quick-start-typescript-2.0.0-arm64.exe",
"releaseDate": "@releaseDate",
"releaseName": "2.0.0",
"releaseNotes": "",
"sha512": "@sha512",
"tag": "v2.0.0",
"version": "2.0.0",
}
`;

exports[`invalid signature 1`] = `"ERR_UPDATER_INVALID_SIGNATURE"`;

exports[`invalid signature 2`] = `
Expand Down
24 changes: 24 additions & 0 deletions test/src/updater/nsisUpdaterTest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,30 @@ test("downgrade (disallowed, beta)", async () => {
expect(actualEvents).toEqual(expectedEvents)
})

test("github allowPrerelease=true", async () => {
const updater = await createNsisUpdater('1.0.1')
updater.allowPrerelease = true
updater.updateConfigPath = await writeUpdateConfig<GithubOptions>({
provider: "github",
owner: "mmaietta",
repo: "electron-builder-test"
})
const updateCheckResult = await updater.checkForUpdates()
expect(removeUnstableProperties(updateCheckResult?.updateInfo)).toMatchSnapshot()
})

test("github allowPrerelease=false", async () => {
const updater = await createNsisUpdater('1.0.1')
updater.allowPrerelease = false
updater.updateConfigPath = await writeUpdateConfig<GithubOptions>({
provider: "github",
owner: "mmaietta",
repo: "electron-builder-test"
})
const updateCheckResult = await updater.checkForUpdates()
expect(removeUnstableProperties(updateCheckResult?.updateInfo)).toMatchSnapshot()
})

test("file url generic", async () => {
const updater = await createNsisUpdater()
updater.updateConfigPath = await writeUpdateConfig<GenericServerOptions>({
Expand Down

0 comments on commit c0be3e5

Please sign in to comment.