Git Product home page Git Product logo

tdd_bootcamp's Introduction

TDDBC for JavaScript + Jest with Node.js

これは、TDDBCのNode.js + Jest 向けプロジェクトです。

Documentation

セットアップ&テスト

$ git clone https://github.com/tddbc/javascript-jest.git
$ cd javascript-jest
$ npm install
$ npm test

> [email protected] pretest /Users/dictav/golang/src/github.com/dictav/javascript-jest
> npm run fmt && npm run lint

> [email protected] fmt /Users/dictav/golang/src/github.com/dictav/javascript-jest
> prettier --write *js *.json lib/*js

jest_js.config.js 53ms
jest_mjs.config.js 7ms
main.js 8ms
main.mjs 7ms
prettier.config.js 4ms
package-lock.json 355ms
package.json 30ms
lib/sample.js 11ms
lib/sample.mjs 7ms
lib/sample_test.js 11ms
lib/sample_test.mjs 7ms

> [email protected] lint /Users/dictav/golang/src/github.com/dictav/javascript-jest
> eslint main.js main.mjs lib/*js

> [email protected] test /Users/dictav/golang/src/github.com/dictav/javascript-jest
> npm run test:js && npm run test:mjs

> [email protected] test:js /Users/dictav/golang/src/github.com/dictav/javascript-jest
> jest --config jest_js.config.js

 PASS  lib/sample_test.js
  ✓ exported class (2ms)
  ✓ private function (2ms)

Test Suites: 1 passed, 1 total
Tests:       2 passed, 2 total
Snapshots:   0 total
Time:        1.154s, estimated 2s
Ran all test suites.

コマンド

コマンド 内容
npm test lint とテストをまとめて行います
npm run test:js CommonJS の実装のテストを行います
npm run test:mjs ES Module の実装のテストを行います
npm run fmt コードの整形を行います
npm run lint コードの静的検証を行います
npm run watch:js ファイル変更を監視し、変更があったらテストを自動で行います
npm run watch:mjs ファイル変更を監視し、変更があったらテストを自動で行います

License

Copyright (c) 2019 TDD BaseCamp and other contributors

http://devtesting.jp/tddbc/

https://github.com/tddbc

Licensed under the MIT license.

tdd_bootcamp's People

Contributors

progfay avatar dictav avatar dependabot[bot] avatar sue445 avatar kazweda avatar grimrose avatar twada avatar azusa avatar kuniwak avatar nnasaki avatar

Watchers

 avatar

tdd_bootcamp's Issues

整数の閉区間 TODOリスト

課題

整数閉区間を示すクラス(あるいは構造体)をつくりたい。整数閉区間オブジェクトは下端点と上端点を持ち、文字列表現も返せる(例: 下端点 3, 上端点 8 の整数閉区間の文字列表記は "[3,8]")。ただし、上端点より下端点が大きい閉区間を作ることはできない。整数の閉区間は指定した整数を含むかどうかを判定できる。また、別の閉区間と等価かどうかや、完全に含まれるかどうかも判定できる。

https://gist.github.com/twada/75fb219c8cc180e9de166d8a58e877b0

TODO

  • 整数閉区間を示すクラス
    • constructor は指定した整数の下端点と上端点を閉区間とした整数閉区間を返す
      • 上端点と下端点が整数ではないときには、 Error を発生させる
        • 下端点 "string" , 上端点 { object: true } のときには、 Error を発生させる
        • 下端点 0.1 , 上端点 5.5 のときには、 Error を発生させる
      • 上端点より下端点が大きいときには、 Error を発生させる
        • 下端点 8 , 上端点 3 のときには、 Error を発生させる
      • そうでなければ下端点と上端点を保持するインスタンスを作成する
        • 下端点 3 , 上端点 8 のときには、これを保持するインスタンスを作成する
    • toString メソッドは、整数閉区間の文字列表現を返す
      • 下端点 3 , 上端点 8 のときには、文字列表記 [3, 8] を返す
    • has メソッドは指定した整数を含むかどうかを判定できる
      • 整数閉区間に対して引数が範囲内であれば、 true を返す
        • 下端点 3 , 上端点 8 の整数閉区間に対して引数が 3 のとき、 true を返す
        • 下端点 3 , 上端点 8 の整数閉区間に対して引数が 5 のとき、 true を返す
        • 下端点 3 , 上端点 8 の整数閉区間に対して引数が 8 のとき、 true を返す
      • 整数閉区間に対して引数が範囲外であれば、 false を返す
        • 下端点 3 , 上端点 8 の整数閉区間に対して引数が 2 のとき、 false を返す
        • 下端点 3 , 上端点 8 の整数閉区間に対して引数が 9 のとき、 false を返す
    • isEquals メソッドは、別の閉区間と等価かどうか判定できる
      • 引数に ClosedRange クラスのインスタンス以外の値のとき、 false を返す
        • 引数が { lowerEndpoint: 3, uppperEndpoint: 8 }Object のときには、 false を返す
      • 下端点と上端点が一致しているとき、 true を返す
        • 下端点 3 , 上端点 8 の整数閉区間に対して引数が下端点 3 , 上端点 8 の整数閉区間のとき、 true を返す
      • そうでなければ false を返す
        • 下端点 3 , 上端点 8 の整数閉区間に対して引数が下端点 4 , 上端点 8 の整数閉区間のとき、 false を返す
        • 下端点 3 , 上端点 8 の整数閉区間に対して引数が下端点 3 , 上端点 9 の整数閉区間のとき、 false を返す
        • 下端点 3 , 上端点 8 の整数閉区間に対して引数が下端点 4 , 上端点 9 の整数閉区間のとき、 false を返す
    • includes メソッドは、別の閉区間に完全に含まれるかどうか判定できる
      • 整数閉区間Aに対して整数閉区間Bが、Aの上端点よりもBの上端点の方が小さいか等価であり、Aの下端点よりもBの上端点の方が大きいか等価であるとき、 true を返す
        • 下端点 3 , 上端点 8 の整数閉区間に対して引数が下端点 3 , 上端点 8 の整数閉区間のとき、 true を返す
        • 下端点 3 , 上端点 8 の整数閉区間に対して引数が下端点 4 , 上端点 7 の整数閉区間のとき、 true を返す
      • そうでなければ false を返す
        • 下端点 3 , 上端点 8 の整数閉区間に対して引数が下端点 2 , 上端点 8 の整数閉区間のとき、 false を返す

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.