随笔分类 -  Unit Testing

上一页 1 2 3 4 5 6 ··· 10 下一页
摘要:Sync api: getBy* queryBy* Async api: findBy* For sync api, when to use which? queryBy*: when the element is not always shown on screen getBy*: when th 阅读全文
posted @ 2024-05-07 14:32 Zhentiw 阅读(3) 评论(0) 推荐(0) 编辑
摘要:Code: import type { paths } from "@octokit/openapi-types"; type OrgRepoResponse = paths["/repos/{owner}/{repo}"]["get"]["responses"]["200"]["content"] 阅读全文
posted @ 2024-04-19 14:25 Zhentiw 阅读(6) 评论(0) 推荐(0) 编辑
摘要:Code: config.go package projector import ( "fmt" "os" "path" ) type Operation = int const ( Print Operation = iota Add Remove ) type Config struct { A 阅读全文
posted @ 2024-02-26 15:47 Zhentiw 阅读(3) 评论(0) 推荐(0) 编辑
摘要:struct Rectangle { width: i32, height: i32 } impl Rectangle { // Only change the test functions themselves pub fn new(width: i32, height: i32) -> Self 阅读全文
posted @ 2024-02-23 18:50 Zhentiw 阅读(21) 评论(0) 推荐(0) 编辑
摘要:pub fn is_even(num: i32) -> bool { num % 2 == 0 } /* This attribute indicates that the following module is a conditional compilation module that shoul 阅读全文
posted @ 2024-02-23 18:46 Zhentiw 阅读(13) 评论(0) 推荐(0) 编辑
摘要:Vanilla Go includes Testing A test is a file with suffix_test.go You define functions with prefix Test and with an special signature receiving a *test 阅读全文
posted @ 2024-02-06 22:16 Zhentiw 阅读(4) 评论(0) 推荐(0) 编辑
摘要:import { afterEach, test, expect, vi, beforeEach } from 'vitest'; import { render } from 'test/utilities'; import TimeZone from '.'; beforeEach(() => 阅读全文
posted @ 2023-09-27 21:39 Zhentiw 阅读(40) 评论(0) 推荐(0) 编辑
摘要:1. Globally import In vitest, you need to do import { it, expect, test } from 'vitest'; In every test files, If you don't want to do it you can set co 阅读全文
posted @ 2023-09-20 01:33 Zhentiw 阅读(46) 评论(0) 推荐(0) 编辑
摘要:1. TSD: https://github.com/SamVerschueren/tsd import {expectType} from 'tsd'; import concat from '.'; expectType<string>(concat('foo', 'bar')); expect 阅读全文
posted @ 2023-05-07 16:08 Zhentiw 阅读(24) 评论(0) 推荐(0) 编辑
摘要:import { WatermarkOverlay } from '../watermark-overlay' describe('WatermarkOverlay', () => { let cmp: HTMLElement let fixture: HTMLElement let shadow: 阅读全文
posted @ 2023-03-18 02:56 Zhentiw 阅读(12) 评论(0) 推荐(0) 编辑
摘要:import { test } from '@playwright/test'; test.beforeEach(async ({ page }) => { await page.goto('http://localhost:3000'); }); test('selectors', async ( 阅读全文
posted @ 2023-01-18 16:14 Zhentiw 阅读(37) 评论(0) 推荐(0) 编辑
摘要:jest.mock('./filename', () => { const originalModule = jest.requireActual('./filename') return { ...originalModule, fnA: jest.fn(), fnB: (b: boolean): 阅读全文
posted @ 2022-12-22 16:06 Zhentiw 阅读(22) 评论(0) 推荐(0) 编辑
摘要:Co-Variance: declare let b: string declare let c: string | number c = b // ✅ // string is a sub-type of string | number // all elements of string appe 阅读全文
posted @ 2022-11-09 17:18 Zhentiw 阅读(32) 评论(0) 推荐(0) 编辑
摘要:Example: expect(contextSpy.sendEncodedMessage).toHaveBeenCalledWith( expect.objectContaining({ correlationId: expect.objectContaining({ operationId: ' 阅读全文
posted @ 2022-11-03 17:57 Zhentiw 阅读(21) 评论(0) 推荐(0) 编辑
摘要:https://github.com/kentcdodds/react-testing-library-course/commit/1148e920b8d055d9ca9ef1c372e233d2e950ff1f User-event: https://testing-library.com/doc 阅读全文
posted @ 2022-10-30 21:06 Zhentiw 阅读(63) 评论(0) 推荐(0) 编辑
摘要:Must have Configure Jest to Run Setup for All Tests with Jest setupFilesAfterEnv We want to include '@testing-library/jest-dom'so that we can have suc 阅读全文
posted @ 2022-10-18 13:59 Zhentiw 阅读(27) 评论(0) 推荐(0) 编辑
摘要:const { of } = require("rxjs"); const { mergeMap, map, delay, catchError } = require("rxjs/operators"); describe("subscribe & assert testing in RxJS", 阅读全文
posted @ 2022-10-17 14:12 Zhentiw 阅读(24) 评论(0) 推荐(0) 编辑
摘要:For example we have a search input: const input$ = fromEvent(document.getElementById("#input"), "input"); input$ .pipe( debounceTime(200), pluck("targ 阅读全文
posted @ 2022-10-14 20:56 Zhentiw 阅读(77) 评论(0) 推荐(0) 编辑
摘要:const { TestScheduler } = require("rxjs/testing"); const { map, take, delay, mapTo, catchError } = require("rxjs/operators"); const { concat, from, of 阅读全文
posted @ 2022-10-14 20:24 Zhentiw 阅读(37) 评论(0) 推荐(0) 编辑
摘要:describe("Marble testing in Rxjs", () => { let testScheduler; beforeEach(() => { testScheduler = new TestScheduler((actual, expected) => { expect(actu 阅读全文
posted @ 2022-10-14 20:20 Zhentiw 阅读(14) 评论(0) 推荐(0) 编辑

上一页 1 2 3 4 5 6 ··· 10 下一页
点击右上角即可分享
微信分享提示