Last active
February 12, 2019 23:07
-
-
Save ababup1192/c5f8f446b2bd074045ab3f3a3eef9fce to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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(); | |
| }); | |
| }); | |
| }); |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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