-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
325423d
commit 055aa0a
Showing
17 changed files
with
2,576 additions
and
13 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: Npm | ||
|
||
on: | ||
push: | ||
branches: | ||
- '**' | ||
paths: | ||
- 'typescript/**' | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 18.x | ||
- name: Yarn install | ||
working-directory: typescript | ||
run: yarn install | ||
- name: Test | ||
working-directory: typescript | ||
run: yarn jest |
This file contains 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
This file contains 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
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
lts/* |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
{ | ||
"printWidth": 120, | ||
"singleQuote": true | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
config: | ||
git: | ||
auto-push: true | ||
polling-period: 2s | ||
mob-timer: | ||
duration: 5m0s | ||
tcr: | ||
language: typescript | ||
toolchain: yarn |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
toolchains: | ||
default: yarn | ||
compatible-with: [yarn] | ||
source-files: | ||
directories: [src] | ||
patterns: ['(?i)^.*\.ts$'] | ||
test-files: | ||
directories: [test] | ||
patterns: ['(?i)^.*\.ts$'] |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
build: | ||
- os: [darwin, linux, windows] | ||
arch: ["386", amd64, arm64] | ||
command: yarn | ||
arguments: [jest, --testNamePattern=DO-NOT-RUN-ANYTHING, --silent] | ||
test: | ||
- os: [darwin, linux, windows] | ||
arch: ["386", amd64, arm64] | ||
command: yarn | ||
arguments: [jest] | ||
test-result-dir: test_results | ||
|
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
# Getting Started with Bowling Game kata in Typescript | ||
|
||
## Prerequisites | ||
|
||
- macOS, Linux or Windows | ||
- [git](https://git-scm.com/) client | ||
- [curl](https://curl.se/download.html) command line utility | ||
- [node](https://nodejs.org/en/download) | ||
- [yarn](https://classic.yarnpkg.com/lang/en/docs/install) | ||
<details><summary>Details</summary> | ||
|
||
You can install node directly or through nvm. | ||
|
||
</details> | ||
|
||
## Getting ready | ||
|
||
### 1 - Clone the kata repository | ||
|
||
```shell | ||
git clone https://github.com/murex/Kata-BowlingGame.git | ||
``` | ||
|
||
### 2 - Go to the kata's `typescript` directory | ||
|
||
```shell | ||
cd Kata-BowlingGame/typescript | ||
``` | ||
|
||
### 3 - Download dependencies | ||
|
||
```shell | ||
yarn install | ||
``` | ||
|
||
## Running the kata | ||
|
||
You can run the kata from the command line or from your IDE of choice. | ||
|
||
You may also run it using [TCR](../tcr/TCR.md) if you want to add a bit of spice. | ||
|
||
- [From a terminal with Yarn](#running-the-kata-from-a-terminal-with-yarn) | ||
- [From a terminal with TCR](#running-the-kata-from-a-terminal-with-tcr) | ||
|
||
<a name="running-the-kata-from-a-terminal-with-yarn"/></a> | ||
|
||
### Running the kata from a terminal with Yarn | ||
|
||
> ***Reminder***: the command below should be run from [Kata-BowlingGame/typescript](.) directory | ||
The kata comes with a Yarn test target pre-configured. Just type the following to run it. | ||
|
||
```shell | ||
yarn test | ||
``` | ||
|
||
<a name="running-the-kata-from-a-terminal-with-tcr"/></a> | ||
|
||
### Running the kata from a terminal with TCR | ||
|
||
> ***Note to Windows users*** | ||
> | ||
> Use a **git bash** terminal for running the command below. | ||
> _Windows CMD and PowerShell are not supported_ | ||
Type the following to start TCR: | ||
|
||
```shell | ||
./tcrw | ||
``` | ||
|
||
Refer to [Using TCR](#using-tcr) section for additional details about TCR and available options. | ||
|
||
<a name="using-tcr"/></a> | ||
|
||
## Using TCR | ||
|
||
### Cheat Sheet | ||
|
||
Here are the main shortcuts available once TCR utility is running: | ||
|
||
| Shortcut | Description | | ||
|-----------|-----------------------------------------------| | ||
| `?` | List available options | | ||
| `d` / `D` | Enter driver role (from main menu) | | ||
| `n` / `N` | Enter navigator role (from main menu) | | ||
| `q` / `Q` | Quit current role - Quit TCR (from main menu) | | ||
| `t` / `T` | Query timer status (from driver role only) | | ||
| `p` / `P` | Toggle on/off git auto-push (from main menu) | | ||
|
||
### Additional Details | ||
|
||
Refer to [TCR - Test && Commit || Revert](../tcr/TCR.md) page | ||
for additional details and explanations about TCR utility. |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
module.exports = { | ||
"preset": 'ts-jest', | ||
"reporters": [ "default", "jest-junit" ] | ||
}; |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
{ | ||
"name": "bowling_game", | ||
"version": "1.0.0", | ||
"description": "Bowling Game", | ||
"author": "Murex", | ||
"license": "MIT", | ||
"devDependencies": { | ||
"@types/jest": "*", | ||
"jest": "*", | ||
"ts-jest": "*", | ||
"jest-junit": "*", | ||
"typescript": "*" | ||
}, | ||
"scripts": { | ||
"test": "jest --watchAll" | ||
}, | ||
"jest-junit": { | ||
"outputDirectory": "./test_results" | ||
} | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
/* | ||
Copyright (c) 2023 Murex | ||
Permission is hereby granted, free of charge, to any person obtaining a copy | ||
of this software and associated documentation files (the "Software"), to deal | ||
in the Software without restriction, including without limitation the rights | ||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
copies of the Software, and to permit persons to whom the Software is | ||
furnished to do so, subject to the following conditions: | ||
The above copyright notice and this permission notice shall be included in all | ||
copies or substantial portions of the Software. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
SOFTWARE. | ||
*/ | ||
|
||
export function bowlingScore(...rolls: number[]): number { | ||
return 0; | ||
} |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
#!/usr/bin/env sh | ||
# | ||
# Copyright (c) 2021 Murex | ||
# | ||
# Permission is hereby granted, free of charge, to any person obtaining a copy | ||
# of this software and associated documentation files (the "Software"), to deal | ||
# in the Software without restriction, including without limitation the rights | ||
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell | ||
# copies of the Software, and to permit persons to whom the Software is | ||
# furnished to do so, subject to the following conditions: | ||
# | ||
# The above copyright notice and this permission notice shall be included in all | ||
# copies or substantial portions of the Software. | ||
# | ||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR | ||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, | ||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE | ||
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER | ||
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, | ||
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE | ||
# SOFTWARE. | ||
|
||
base_dir="$(cd "$(dirname -- "$0")" && pwd)" | ||
. "${base_dir}/../tcr/tcr.sh" |
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
import {bowlingScore} from "../src/BowlingGame"; | ||
|
||
describe("bowling_game", () => { | ||
// Remove the ".skip" below to enable this test case | ||
test.skip('acceptance test', () => { | ||
expect(bowlingScore(1, 4, 4, 5, 6, 4, 5, 5, 10, 0, 1, 7, 3, 6, 4, 10, 2, 8, 6)).toEqual(133); | ||
}); | ||
}); |
Oops, something went wrong.