TECH |
Engadget Japanese |
エンガジェット執筆陣がオススメするアイテムがAmazonタイムセール祭りでお買い得に! |
https://japanese.engadget.com/timesale-mini-review-024806066.html
|
amazon |
2021-10-31 02:48:06 |
TECH |
Techable(テッカブル) |
火星でCO2からロケット燃料を生成する新手法! 帰りの燃料は「現地調達」なるか |
https://techable.jp/archives/165604
|
現地調達 |
2021-10-31 02:00:17 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
27年間事務屋だった私、pythonと機械学習を学んだら半年間でいい感じで実証実験ができたよ |
https://qiita.com/chuukai/items/9fb519f7fcf702b0a3bf
|
実証実験と言えるかと思いますが、検証がないので研究にはなりません。 |
2021-10-31 11:23:56 |
python |
Pythonタグが付けられた新着投稿 - Qiita |
GStreamerで連続ファイルにエンコード・記録する |
https://qiita.com/moko3syzygy/items/08d8e3ff07b4b4dbac44
|
コンテナでやろうとする方向けの注意としてはJetpackとの違いはBSPやバグフィックスだそうで、LTのイメージはrとなります。 |
2021-10-31 11:23:19 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
cs1061が表示される、「GameDirector」に「DecreaseHp」の定義が含まれていないといわれてしまう |
https://teratail.com/questions/367050?rss=all
|
|
2021-10-31 11:42:45 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
C#でdetatableにCSVデータの挿入のやり方 |
https://teratail.com/questions/367049?rss=all
|
いろいろとweb検索をしたのですがfor文でCSVのデータを入れているサイトが見つかりません。 |
2021-10-31 11:40:13 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
TerraformでのAWS IAMユーザー "iam_user_login_profile" pgpkey 設定方法について |
https://teratail.com/questions/367048?rss=all
|
TerraformでのAWSIAMユーザーquotiamuserloginprofilequotpgpkey設定方法について前提・実現したいことTerraformでIAMユーザーの作成を実装しており、以下の実現をしたいです。 |
2021-10-31 11:35:51 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
parallels Eclipsについて |
https://teratail.com/questions/367047?rss=all
|
eclips |
2021-10-31 11:32:42 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
アプリ開発おすすめの本 |
https://teratail.com/questions/367046?rss=all
|
cssjavajsp |
2021-10-31 11:19:55 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
github上のシンタックスエラーの解決について |
https://teratail.com/questions/367045?rss=all
|
github上のシンタックスエラーの解決について前提・実現したいことポートフォリオ作成中ですが、githubにpushしたところ、デプロイにてシンタックスエラーが出てしまい、書行けて方法が分からず、質問致します。 |
2021-10-31 11:18:15 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
配列の受け取り方とその考え方について |
https://teratail.com/questions/367044?rss=all
|
配列の受け取り方とその考え方について前提・実現したいこと大学の講義で出されている問題Javaについての質問になります。 |
2021-10-31 11:14:03 |
Program |
[全てのタグ]の新着質問一覧|teratail(テラテイル) |
textareaの文字を改行させたい |
https://teratail.com/questions/367043?rss=all
|
|
2021-10-31 11:12:25 |
Azure |
Azureタグが付けられた新着投稿 - Qiita |
エフェメラル OS ディスクの Azure VM を作ってみた |
https://qiita.com/mnrst/items/00dfbca974f855956a89
|
エフェメラルOSディスクのAzureVMを作ってみた背景と目的エフェメラルディスクは、VMが起動する物理マシン上に割り当てたディスク領域で、VMに障害があって別の物理マシンに移動してしまったりVMを割り当て解除すると、物理マシン上に割り当てたディスク領域が使用出来なくなります。 |
2021-10-31 11:15:32 |
海外TECH |
DEV Community |
Know this easily test React app |
https://dev.to/thangphan37/know-this-easily-test-react-app-3gn1
|
Know this easily test React appJest and Testing Library were the most powerful tool for testing React App In this post we are going to discover the important concept of them Let s dig in This is the simplest test that we can write in the first time using Jest test plus equal gt expect toBe Test AsynchronousSuppose that I have a fake API that returns the user response with id in the test case I intentionally set change id to check whether the test works properly or not and I end up with a passed message The reason is that the test case is completed before the promise finishes test user is equal user in response gt const user userId id title delectus aut autem completed false fetch then response gt response json then json gt expect user toEqual json In order to avoid this bug we need to have return in front of fetch test user is equal user in response gt const user userId id title delectus aut autem completed false return fetch then response gt response json then json gt expect user toEqual json The test case above can rewrite using async await test user is equal user in response using async await async gt const user userId id title delectus aut autem completed false const res await fetch const resJson await res json expect user toEqual resJson Useful methodsbeforeAll To add some code that we want to run once before the test cases is run afterAll To add some code that we want to run after all test cases are finished e g clear the database beforeEach To add some code that we want to run before each test case afterEach To add some code that we want to run at the point that each test case finishes Suppose that I have three test cases and I set beforeEach gt console log beforeEach is working Three console will appear on my terminal Conversely Using beforeAll I only see one console The logic way is the same with afterEach and afterAll The order runWe already have describe combines many test cases test test case What is the order that jest run if test file was mixed by many describe test You only need to remember this order describe gt test To illustrate describe describe for demo gt console log this is describe test plus equal gt console log this is test case in describe expect toBe describe sub describe for demo gt console log this is sub describe test plus equal gt console log this is test case in sub describe expect toBe Can you spot on the order in the example above My terminal log this is describethis is sub describethis is test case in describethis is test case in sub describe Mock functionI think the most powerful of Jest is having a mock function that we are able to mock the params object which defined by the new keyword and customize the return value This is an example function plusTwoNumbers list Array lt number gt callback a number b number gt void callback list list test mock function callback gt const mockFnc jest fn a b gt console log total a b plusTwoNumbers mockFnc We mock callback function get the params of it and customize the result console log total a b We are also able to mock modules e g I use uuid in order to generate a unique id When I move on to testing instead of using uuid I can mock the uuid module like the code below Normally whenever I call uuid v I will get a random value like this c db acafBut I want my value to be I can use the code below import as uuid from uuid jest mock uuid test mock uuid module gt uuid v mockReturnValue console log uuid v uuid v Otherwise I can use mockImplementation to customize uuid v mockImplementation gt mockImplementation is the function that we customize the function that is created from other modules Config JestI m going to introduce to you about the most important configs in Jest Let s go collectCoverageFromThis config helps Jest knows exactly the place that needs to collect information and check coverage It is very useful you can run Run jest coverage in order to figure out the component the function we still need to write test and discover the spots we still don t test yet moduleDirectoriesThis config points to the module that we will use in the test file By default it was configured node modules and we are able to use the the module under node modules folder in our test cases moduleNameMapperThis config provides for us the ability to access the resources based on the place that we have set moduleNameMapper assets lt rootDir gt images See the example above now we set the path assets that pointed to lt rootDir gt images If I set assets logo png Jest will find lt rootDir gt images logo png rootDirBy default it is the place that contains jest config js package json The place is where Jest will find to use modules and run test cases It turns out I can set rootDir test and run test cases without config roots but I shouldn t do this rootsThis is the config that we set the place that test files belong to For example If I set roots pages but I write test in test folder which is the same level with pages No test cases will be run with the config above I need to change pages gt test testMatchWe use this config in order to communicate to Jest what files we want to test otherwise please skip testPathIgnorePatternsPlease ignore files under a place that is the reason this config exists transformSometimes in our test cases we write some new code that node doesn t support at all so we need to transform to the code that Jest can understand If my project use typescript I need to set up transform in order to make typescript to javascript code that node can understand transformIgnorePatternsWe might have some files some folders we don t want to transform so we use this config How to write testWe need to write tests in order to be more confident about the code that we wrote So when we think about the test cases the core concept is we have to think about the use case do not think about the code It means we must focusinto what s the future that the code can support for users This is the main concept when we think about creating test cases e g I have created a react hook in order to support four features below returns the value in first data using first property condition true returns the value in second data using second property condition false returns the value in second data using first property condition false returns the default value with second data undefined condition false import as React from react type Props lt F S gt condition boolean data F S function useInitialState lt F S gt condition data Props lt F S gt const giveMeState React useCallback property keyof F anotherProperty S extends undefined undefined keyof S undefined defaultValue Array lt string gt string number undefined gt return condition data property data anotherProperty property as unknown as keyof S defaultValue condition data return giveMeState export useInitialState So I only need to write four test cases for the four features above import useInitialState from utils hooks initial state import renderHook from testing library react hooks describe useInitialState gt const mockFirstData name Thang age test returns the value in first data using first property condition true gt const mockSecondData name Phan age const result renderHook gt useInitialState condition Boolean mockFirstData data mockFirstData mockSecondData const data result current giveMeState name undefined expect data toBe mockFirstData name test returns the value in second data using second property condition false gt const mockSecondData firstName Phan age const result renderHook gt useInitialState condition Boolean false data mockFirstData mockSecondData const data result current giveMeState name firstName expect data toBe mockSecondData firstName test returns the value in second data using first property condition false gt const mockSecondData name Phan age const result renderHook gt useInitialState condition Boolean false data mockFirstData mockSecondData const data result current giveMeState name undefined expect data toBe mockSecondData name test returns the default value with second data undefined condition false gt const mockDefaultValue const result renderHook gt useInitialState condition Boolean false data mockFirstData undefined const data result current giveMeState age undefined mockDefaultValue expect data toBe mockDefaultValue Testing LibraryLet s take a slight review about the main things in Testing Library getBy we find the DOM element throw error if no element is found queryBy we find the DOM element return null if no element is found findBy we find the DOM element throw an error if no element is found the search process is a promise The list below is the priority we should use in order to write test nearer with the way that our app is used getByRolegetByLabelTextgetByAltTextgetByDisplayValueFor example I have a component that contains two components AutoAddress Address I need to find the use case that I want to support in order to create test cases This is a test case by default name value of inputs was set render the componentscreate the mockResult valueadd assertionstest by default name of address input was set async gt render lt AutoAddress wasSubmitted false gt lt Address wasSubmitted false gt lt AutoAddress gt const mockResult namePrefectureSv prefertureSv namePrefectureSvLabel prefectureSvLabel nameCity city expect screen getByLabelText Prefecture Code toHaveAttribute name mockResult namePrefectureSv expect screen getByLabelText Prefecture toHaveAttribute name mockResult namePrefectureSvLabel expect screen getByLabelText City toHaveAttribute name mockResult nameCity And this is a test case returns one address through postCode render the componentscreate the mockResult valuemock the request APIinput the postCodeclick the search buttonadd assertionstest returns one address through postCode async gt const mockResult id zipCode prefectureCode city Tokyo server use rest get process env NEXT PUBLIC API OFF KINTO API ADDRESS req res ctx gt return res ctx json mockResult render lt AutoAddress wasSubmitted false gt lt Address wasSubmitted false gt lt AutoAddress gt input the post code value userEvent type screen getByLabelText first postCode userEvent type screen getByLabelText second postCode search the address userEvent click screen getByRole button name search address i wait for the search process finishes await waitForElementToBeRemoved gt screen getByRole button name searching i const address mockResult const prefectureCode city address expect screen getByLabelText Prefecture Code toHaveAttribute value prefectureCode expect screen getByLabelText Prefecture toHaveAttribute value PREFECTURE CODE prefectureCode as keyof typeof PREFECTURE CODE expect screen getByLabelText City toHaveAttribute value city RecapWe just learned the main concepts in Testing React App Let s recap some key points Testing asynchronous need to have return in front of promise We are able to control testing using Jest configs Thinking test cases we must forget about code focus on the use case The order of DOM methods in Testing Library |
2021-10-31 02:02:21 |
ニュース |
BBC News - Home |
Covid-19 vaccine: Jabs offered to 12-15-year-olds at 800 schools |
https://www.bbc.co.uk/news/uk-59107256?at_medium=RSS&at_campaign=KARANGA
|
javid |
2021-10-31 02:38:30 |
LifeHuck |
ライフハッカー[日本版] |
iPhoneのイライラを解決する10の方法 |
https://www.lifehacker.jp/2021/10/24492310-of-the-worst-iphone-annoyances-and-how-to-fix-them.html
|
iphone |
2021-10-31 12:00:00 |
LifeHuck |
ライフハッカー[日本版] |
【Amazonタイムセール祭り】最新のAnker大容量モバイルバッテリーが3,192円、スマートトラッカーが1,782円など |
https://www.lifehacker.jp/2021/10/amazon-timesale-fes-2021-1031-1.html
|
【Amazonタイムセール祭り】最新のAnker大容量モバイルバッテリーが円、スマートトラッカーが円などAmazonアマゾンでは、年月日時から月日まで「Amazonタイムセール祭り」を開催中です。 |
2021-10-31 11:45:00 |
北海道 |
北海道新聞 |
神戸市長選、投票始まる 現職と4新人の争い |
https://www.hokkaido-np.co.jp/article/606273/
|
任期満了 |
2021-10-31 11:01:00 |
ビジネス |
東洋経済オンライン |
「のりたま・ゆかり・味道楽」ふりかけ不動3強の訳 長い歴史が強み、子ども時代に親しんだ味 | 食品 | 東洋経済オンライン |
https://toyokeizai.net/articles/-/465250?utm_source=rss&utm_medium=http&utm_campaign=link_back
|
全国各地 |
2021-10-31 11:30:00 |
海外TECH |
reddit |
[2021 ISU Grand Prix of Figure Skating] Skate Canada - Women's Free Skate Discussion Thread |
https://www.reddit.com/r/FigureSkating/comments/qhbkzk/2021_isu_grand_prix_of_figure_skating_skate/
|
ISU Grand Prix of Figure Skating Skate Canada Women x s Free Skate Discussion ThreadDiscuss the Women s Free Skate here Saturday October Vancouver BC Canada UTC Time and Date Converter Detailed Colour Schedule Entries Planned Program Content Music Selections Results STREAMS The Official ISU YouTube Channel will stream all events and is available in nations without broadcaster agreements See the ISU How To Watch page for more information on what nations have broadcast agreements Or you know you can use a VPN to evade region restrictions The Opera internet browser has a free built in VPN or there are many paid VPN services USA viewers must be subscribed to Peacock Premium a month with a day free trial Canadian viewers CBC Streams Russian Viewers Channel will stream on their website and their YouTube channel Links for other national streams and possible fanstreams are available on SYWTWFS s post You can also discuss the events on the r figureskating Discord Channel more information on the community and its rules is here October Competition Weekend Discussion Thread Masterpost submitted by u CountyKildare to r FigureSkating link comments |
2021-10-31 02:15:30 |
コメント
コメントを投稿