Skip to content

Instantly share code, notes, and snippets.

@ababup1192
Last active February 12, 2019 23:07
Show Gist options
  • Select an option

  • Save ababup1192/c5f8f446b2bd074045ab3f3a3eef9fce to your computer and use it in GitHub Desktop.

Select an option

Save ababup1192/c5f8f446b2bd074045ab3f3a3eef9fce to your computer and use it in GitHub Desktop.
import * as index from '../index';
describe('Tests', () => {
describe('isAdult /* index.tsでexportした関数名が入る */', () => {
it('18歳なら大人' /* isAdult(大人ですか?) という質問に対して trueなので大人 */, () => {
expect(index.isAdult(18 /* age */)).toBeTruthy();
});
it('17歳なら子供' /* isAdult(大人ですか?) という質問に対して trueなので子供 */, () => {
expect(index.isAdult(17 /* age */)).toBeFalsy();
});
});
});
export const isAdult = (age:number /* ここに18や17などの年齢を表す数字が入る */): boolean /* 大人か否かを返す */ => {
return 18 <= age;
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment