Skip to content

Commit

Permalink
test: Enhance test case name (#39)
Browse files Browse the repository at this point in the history
* test: Remove should
* test: Rename test case title
  • Loading branch information
peaceiris authored Jan 10, 2020
1 parent 6ad5947 commit 7cab470
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 11 deletions.
8 changes: 4 additions & 4 deletions __tests__/get-latest-version.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ const urlBrewExpected: string = `https://formulae.brew.sh/api/formula/${repo}.js
const urlGithubExpected: string = `https://api.github.com/repos/${org}/${repo}/releases/latest`;

describe('getURL()', () => {
test('should return expected URL', () => {
test('return expected URL', () => {
const urlBrew: string = getURL(org, repo, 'brew');
const urlGithub: string = getURL(org, repo, 'github');

Expand All @@ -30,7 +30,7 @@ describe('getURL()', () => {
describe('getLatestVersion()', () => {
let versionLatestExpected: string = '0.3.5';

test('should return latest version via brew', async () => {
test('return latest version via brew', async () => {
nock('https://formulae.brew.sh')
.get(`/api/formula/${repo}.json`)
.reply(200, jsonTestBrew);
Expand All @@ -39,7 +39,7 @@ describe('getLatestVersion()', () => {
expect(versionLatest).toMatch(versionLatestExpected);
});

test('should return latest version via GitHub', async () => {
test('return latest version via GitHub', async () => {
nock('https://api.github.com')
.get(`/repos/${org}/${repo}/releases/latest`)
.reply(200, jsonTestGithub);
Expand All @@ -48,7 +48,7 @@ describe('getLatestVersion()', () => {
expect(versionLatest).toMatch(versionLatestExpected);
});

test('should return exception 404', async () => {
test('return exception 404', async () => {
nock('https://formulae.brew.sh')
.get(`/api/formula/${repo}.json`)
.reply(404);
Expand Down
4 changes: 2 additions & 2 deletions __tests__/get-os.test.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import {getOS} from '../src/get-os';

describe('getOS()', () => {
test('should return expected OS name', () => {
test('return expected OS name', () => {
expect(getOS('linux')).toBe('unknown-linux-gnu');
expect(getOS('darwin')).toBe('apple-darwin');
expect(getOS('win32')).toBe('pc-windows-msvc');
});

test('should return exception', () => {
test('return exception', () => {
expect(() => {
getOS('centos');
}).toThrowError('centos is not supported');
Expand Down
2 changes: 1 addition & 1 deletion __tests__/get-url.test.ts
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import {getURL} from '../src/get-url';

describe('getURL()', () => {
test('should return extected URL', () => {
test('return extected URL', () => {
const testVersion: string = '0.3.5';
const baseURL: string = `https://github.com/rust-lang/mdBook/releases/download/v${testVersion}/mdbook-v${testVersion}-x86_64`;
const urlLinux: string = `${baseURL}-unknown-linux-gnu.tar.gz`;
Expand Down
8 changes: 4 additions & 4 deletions __tests__/main.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,14 @@ afterEach(() => {
});

describe('Integration testing run()', () => {
test('should install custom version', async () => {
test('succeed in installing a custom version', async () => {
const testVersion: string = '0.3.4';
process.env['INPUT_MDBOOK-VERSION'] = testVersion;
const result: main.actionResult = await main.run();
expect(result.output).toMatch(`mdbook v${testVersion}`);
});

test('should install latest version', async () => {
test('succeed in installing the latest version', async () => {
const testVersion: string = 'latest';
process.env['INPUT_MDBOOK-VERSION'] = testVersion;
const result: main.actionResult = await main.run();
Expand All @@ -32,13 +32,13 @@ describe('showVersion()', () => {
output: ''
};

test('should return version', async () => {
test('return version', async () => {
result = await main.showVersion('git', ['--version']);
expect(result.exitcode).toBe(0);
expect(result.output).toMatch(/git version/);
});

test('should return exception', async () => {
test('return exception', async () => {
try {
result = await main.showVersion('gitgit', ['--version']);
} catch (e) {
Expand Down

0 comments on commit 7cab470

Please sign in to comment.