Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Fix testing only linux #53

Merged
merged 1 commit into from
Jan 17, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 37 additions & 33 deletions __tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,21 +34,23 @@ describe('Integration testing run()', () => {
expect(result.output).toMatch('mdbook v0.3.5');
});

test('fail to install a custom version due to 404 of tarball', async () => {
const testVersion: string = '0.3.4';
process.env['INPUT_MDBOOK-VERSION'] = testVersion;
nock('https://github.com')
.get(
`/rust-lang/mdBook/releases/download/v${testVersion}/mdbook-v${testVersion}-x86_64-unknown-linux-gnu.tar.gz`
)
.reply(404);
try {
const result: main.actionResult = await main.run();
console.debug(result.output);
} catch (e) {
expect(e).toThrow(FetchError);
}
});
if (process.platform === 'linux') {
test('fail to install a custom version due to 404 of tarball', async () => {
const testVersion: string = '0.3.4';
process.env['INPUT_MDBOOK-VERSION'] = testVersion;
nock('https://github.com')
.get(
`/rust-lang/mdBook/releases/download/v${testVersion}/mdbook-v${testVersion}-x86_64-unknown-linux-gnu.tar.gz`
)
.reply(404);
try {
const result: main.actionResult = await main.run();
console.debug(result.output);
} catch (e) {
expect(e).toThrow(FetchError);
}
});
}

test('fail to install the latest version due to 404 of brew.sh', async () => {
const testVersion: string = 'latest';
Expand All @@ -64,24 +66,26 @@ describe('Integration testing run()', () => {
}
});

test('fail to install the latest version due to 404 of tarball', async () => {
const testVersion: string = 'latest';
process.env['INPUT_MDBOOK-VERSION'] = testVersion;
nock('https://formulae.brew.sh')
.get(`/api/formula/${repo}.json`)
.reply(200, jsonTestBrew);
nock('https://github.com')
.get(
`/rust-lang/mdBook/releases/download/v0.3.5/mdbook-v0.3.5-x86_64-unknown-linux-gnu.tar.gz`
)
.reply(404);
try {
const result: main.actionResult = await main.run();
console.debug(result.output);
} catch (e) {
expect(e).toThrow(FetchError);
}
});
if (process.platform === 'linux') {
test('fail to install the latest version due to 404 of tarball', async () => {
const testVersion: string = 'latest';
process.env['INPUT_MDBOOK-VERSION'] = testVersion;
nock('https://formulae.brew.sh')
.get(`/api/formula/${repo}.json`)
.reply(200, jsonTestBrew);
nock('https://github.com')
.get(
`/rust-lang/mdBook/releases/download/v0.3.5/mdbook-v0.3.5-x86_64-unknown-linux-gnu.tar.gz`
)
.reply(404);
try {
const result: main.actionResult = await main.run();
console.debug(result.output);
} catch (e) {
expect(e).toThrow(FetchError);
}
});
}
});

describe('showVersion()', () => {
Expand Down