feat: Implement tasks feature using NGRX signals and remove the old counter store, alongside general project configuration and skill documentation updates.
continuous-integration/drone/pr Build is passing
continuous-integration/drone/pr Build is passing
This commit is contained in:
File diff suppressed because it is too large
Load Diff
@@ -17,59 +17,56 @@
|
||||
|
||||
```typescript
|
||||
// Jasmine
|
||||
const spy = jasmine.createSpy("callback");
|
||||
spy.and.returnValue("value");
|
||||
expect(spy).toHaveBeenCalledWith("arg");
|
||||
const spy = jasmine.createSpy('callback');
|
||||
spy.and.returnValue('value');
|
||||
expect(spy).toHaveBeenCalledWith('arg');
|
||||
|
||||
// Vitest
|
||||
const spy = vi.fn();
|
||||
spy.mockReturnValue("value");
|
||||
expect(spy).toHaveBeenCalledWith("arg");
|
||||
spy.mockReturnValue('value');
|
||||
expect(spy).toHaveBeenCalledWith('arg');
|
||||
```
|
||||
|
||||
### SpyOn Migration
|
||||
|
||||
```typescript
|
||||
// Jasmine
|
||||
spyOn(service, "method").and.returnValue(of(data));
|
||||
spyOn(service, 'method').and.returnValue(of(data));
|
||||
|
||||
// Vitest
|
||||
vi.spyOn(service, "method").mockReturnValue(of(data));
|
||||
vi.spyOn(service, 'method').mockReturnValue(of(data));
|
||||
```
|
||||
|
||||
### createSpyObj Migration
|
||||
|
||||
```typescript
|
||||
// Jasmine
|
||||
const mockService = jasmine.createSpyObj("UserService", [
|
||||
"getUser",
|
||||
"updateUser",
|
||||
]);
|
||||
mockService.getUser.and.returnValue(of({ id: "1", name: "Test" }));
|
||||
const mockService = jasmine.createSpyObj('UserService', ['getUser', 'updateUser']);
|
||||
mockService.getUser.and.returnValue(of({ id: '1', name: 'Test' }));
|
||||
|
||||
// Vitest
|
||||
const mockService = {
|
||||
getUser: vi.fn(),
|
||||
updateUser: vi.fn(),
|
||||
getUser: vi.fn(),
|
||||
updateUser: vi.fn(),
|
||||
};
|
||||
mockService.getUser.mockReturnValue(of({ id: "1", name: "Test" }));
|
||||
mockService.getUser.mockReturnValue(of({ id: '1', name: 'Test' }));
|
||||
```
|
||||
|
||||
### Async Testing Migration
|
||||
|
||||
```typescript
|
||||
// Jasmine - using done callback
|
||||
it("should load data", (done) => {
|
||||
service.loadData().subscribe((data) => {
|
||||
expect(data).toBeDefined();
|
||||
done();
|
||||
});
|
||||
it('should load data', (done) => {
|
||||
service.loadData().subscribe((data) => {
|
||||
expect(data).toBeDefined();
|
||||
done();
|
||||
});
|
||||
});
|
||||
|
||||
// Vitest - using async/await
|
||||
it("should load data", async () => {
|
||||
const data = await firstValueFrom(service.loadData());
|
||||
expect(data).toBeDefined();
|
||||
it('should load data', async () => {
|
||||
const data = await firstValueFrom(service.loadData());
|
||||
expect(data).toBeDefined();
|
||||
});
|
||||
```
|
||||
|
||||
@@ -93,19 +90,19 @@ vi.useRealTimers();
|
||||
|
||||
```json
|
||||
{
|
||||
"projects": {
|
||||
"your-app": {
|
||||
"architect": {
|
||||
"test": {
|
||||
"builder": "@angular/build:unit-test",
|
||||
"options": {
|
||||
"tsConfig": "tsconfig.spec.json",
|
||||
"buildTarget": "your-app:build"
|
||||
}
|
||||
"projects": {
|
||||
"your-app": {
|
||||
"architect": {
|
||||
"test": {
|
||||
"builder": "@angular/build:unit-test",
|
||||
"options": {
|
||||
"tsConfig": "tsconfig.spec.json",
|
||||
"buildTarget": "your-app:build"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
@@ -113,11 +110,11 @@ vi.useRealTimers();
|
||||
|
||||
```json
|
||||
{
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"types": ["vitest/globals"]
|
||||
},
|
||||
"include": ["src/**/*.spec.ts"]
|
||||
"extends": "./tsconfig.json",
|
||||
"compilerOptions": {
|
||||
"types": ["vitest/globals"]
|
||||
},
|
||||
"include": ["src/**/*.spec.ts"]
|
||||
}
|
||||
```
|
||||
|
||||
@@ -126,24 +123,19 @@ vi.useRealTimers();
|
||||
For advanced configuration, create a `vite.config.ts`:
|
||||
|
||||
```typescript
|
||||
import { defineConfig } from "vitest/config";
|
||||
import { defineConfig } from 'vitest/config';
|
||||
|
||||
export default defineConfig({
|
||||
test: {
|
||||
globals: true,
|
||||
environment: "jsdom",
|
||||
include: ["src/**/*.spec.ts"],
|
||||
coverage: {
|
||||
provider: "v8",
|
||||
reporter: ["text", "html", "lcov"],
|
||||
exclude: [
|
||||
"node_modules/",
|
||||
"src/test-setup.ts",
|
||||
"**/*.spec.ts",
|
||||
"**/*.d.ts",
|
||||
],
|
||||
test: {
|
||||
globals: true,
|
||||
environment: 'jsdom',
|
||||
include: ['src/**/*.spec.ts'],
|
||||
coverage: {
|
||||
provider: 'v8',
|
||||
reporter: ['text', 'html', 'lcov'],
|
||||
exclude: ['node_modules/', 'src/test-setup.ts', '**/*.spec.ts', '**/*.d.ts'],
|
||||
},
|
||||
},
|
||||
},
|
||||
});
|
||||
```
|
||||
|
||||
|
||||
Reference in New Issue
Block a user