Skip to content

Commit

Permalink
fix: update tests to be async
Browse files Browse the repository at this point in the history
  • Loading branch information
ArthurLobopro committed Feb 14, 2025
1 parent ac9ee2e commit e24e128
Showing 1 changed file with 14 additions and 13 deletions.
27 changes: 14 additions & 13 deletions test/index.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,18 +25,19 @@ describe('updateElectronApp', () => {
describe('repository', () => {
const tmpdir = os.tmpdir();
const packageJson = path.join(tmpdir, 'package.json');

beforeAll(() => {
fs.writeFileSync(packageJson, JSON.stringify({}));
});

it('is required', () => {
expect(() => {
updateElectronApp();
}).toThrow("repo not found. Add repository string to your app's package.json file");
expect(async () => {
await updateElectronApp();
}).rejects.toThrow("repo not found. Add repository string to your app's package.json file");
});

it('from opts', () => {
updateElectronApp({ repo: 'foo/bar' });
it('from opts', async () => {
await updateElectronApp({ repo: 'foo/bar' });
});

it('from package.json', () => {
Expand All @@ -51,13 +52,13 @@ describe('updateElectronApp', () => {

describe('host', () => {
it('must a valid HTTPS URL', () => {
expect(() => {
updateElectronApp({ repo, host: 'http://example.com' });
}).toThrow('host must be a valid HTTPS URL');
expect(async () => {
await updateElectronApp({ repo, host: 'http://example.com' });
}).rejects.toThrow('host must be a valid HTTPS URL');
});

it('from default', () => {
updateElectronApp({
it('from default', async () => {
await updateElectronApp({
updateSource: {
type: UpdateSourceType.ElectronPublicUpdateService,
repo,
Expand All @@ -68,9 +69,9 @@ describe('updateElectronApp', () => {

describe('updateInterval', () => {
it('must be 5 minutes or more', () => {
expect(() => {
updateElectronApp({ repo, updateInterval: '20 seconds' });
}).toThrow('updateInterval must be `5 minutes` or more');
expect(async () => {
await updateElectronApp({ repo, updateInterval: '20 seconds' });
}).rejects.toThrow('updateInterval must be `5 minutes` or more');
});
});
});
Expand Down

0 comments on commit e24e128

Please # to comment.