Skip to content

Commit 1d4aafb

Browse files
committed
x : \mathtt{lintFix}(x) \not\cong x
1 parent 8383fc3 commit 1d4aafb

File tree

3 files changed

+44
-0
lines changed

3 files changed

+44
-0
lines changed

packages/nodejs/src/repro/foo.ts

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
export class Foo {
2+
readonly #bar: string;
3+
4+
constructor(bar: string) {
5+
this.#bar = bar;
6+
}
7+
8+
async baz(): Promise<string> {
9+
await new Promise((resolve) => setTimeout(resolve, 100));
10+
return `Hello ${this.#bar}`;
11+
}
12+
}
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { expect, describe, it, vi } from 'vitest';
2+
3+
import { makeFoo } from './makeFoo.ts';
4+
5+
const mocks = vi.hoisted(() => {
6+
const Foo = vi.fn();
7+
Foo.prototype.baz = vi.fn().mockResolvedValue('Hello fizz');
8+
return { Foo };
9+
});
10+
11+
vi.mock('./foo.ts', () => ({
12+
Foo: mocks.Foo,
13+
}));
14+
15+
describe('makeFoo', () => {
16+
it('should make a Foo', async () => {
17+
const foo = makeFoo('baz');
18+
expect(foo).toBeInstanceOf(mocks.Foo);
19+
});
20+
});
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import { Foo } from './foo.ts';
2+
3+
/**
4+
* Make a Foo
5+
*
6+
* @param bar - The bar to use for the Foo
7+
*
8+
* @returns A Foo
9+
*/
10+
export function makeFoo(bar: string): Foo {
11+
return new Foo(bar);
12+
}

0 commit comments

Comments
 (0)