• Home
  • Features
  • Pricing
  • Docs
  • Announcements
  • Sign In

ckapps / overckd / 13656842746

31 May 2023 01:52PM UTC coverage: 20.328%. First build
13656842746

push

github

web-flow
Merge pull request #17 from ckapps/chore/update-deps

Chore/update deps

32 of 288 branches covered (11.11%)

Branch coverage included in aggregate %.

32 of 270 new or added lines in 73 files covered. (11.85%)

464 of 2152 relevant lines covered (21.56%)

0.76 hits per line

Source File
Press 'n' to go to next uncovered line, 'b' for previous

0.0
/packages/server-cli/src/dependencies/in-memory/recipe.repository.ts
1
import { Context, createReader } from '@marblejs/core';
×
2
import { Reader } from 'fp-ts/lib/Reader';
3
import { Observable } from 'rxjs';
4

5
import { PortionKind } from '@overckd/domain/dist/models/portion-quantifier/portion-quantifier.model';
×
6
import { Recipe } from '@overckd/domain/dist/models/recipe/recipe.model';
7
import { RecipeRepository } from '@overckd/domain/dist/repositories';
8

9
import { InMemoryRepo } from './in-memory-repo';
×
10

11
class RecipeRepo extends InMemoryRepo<Recipe> implements RecipeRepository {
12
  constructor() {
13
    super([
×
14
      {
15
        name: 'recipe 1',
16
        images: [],
17
        ingredients: [],
18
        steps: [
19
          'step 1',
20
          'step 2',
21
          { html: 'Loorem Ipsum dolor', styles: ['text-center'] },
22
        ],
23
        styles: {},
24
        tips: [],
25
      },
26
      {
27
        name: 'recipe 2',
28
        portion: {
29
          kind: PortionKind.Quantity,
30
          count: 2,
31
        },
32
        images: [],
33
        ingredients: [
34
          {
35
            amount: 3,
36
            unit: 'kg',
37
            name: 'Ingredient 1',
38
            alternatives: ['test'],
39
          },
40
          {
41
            amount: 10,
42
            unit: 'ml',
43
            name: 'Ingredient 2',
44
            optional: true,
45
          },
46
          {
47
            amount: 5,
48
            unit: 'TL',
49
            scaleFactor: 1 / 4,
50
            name: 'Ingredient with an scale factor of 0.25',
51
          },
52
          {
53
            amount: '1 Prise',
54
            name: 'Ingredient with textual amount',
55
          },
56
        ],
57
        steps: ['step 1', 'step 2', 'Loorem Ipsum dolor'],
58
        styles: {},
59
        tips: [],
60
      },
61
    ]);
62
  }
63

64
  getAll(): Observable<Recipe[]> {
65
    return this.all.asObservable();
×
66
  }
67

68
  getByName(name: string): Observable<Recipe | undefined> {
69
    return this.findItem({ name });
×
70
  }
71

72
  add(recipe: Recipe): Observable<Recipe> {
73
    return this._add(recipe);
×
74
  }
75

76
  removeByName(name: string): Observable<Recipe> {
77
    return this._remove({ name });
×
78
  }
79

80
  update(recipe: Recipe, name: string): Observable<Recipe | undefined> {
81
    throw new Error('Method not implemented.');
×
82
  }
83

84
  equals(a: Recipe, b: Recipe): boolean {
85
    return a.name === b.name;
×
86
  }
87
}
88

NEW
89
export const MockRecipeRespository: Reader<Context, RecipeRepository> =
×
90
  createReader<RecipeRepository>(() => {
NEW
91
    const repo = new RecipeRepo();
×
92

NEW
93
    return {
×
NEW
94
      add: (...args) => repo.add(...args),
×
NEW
95
      getAll: (...args) => repo.getAll(...args),
×
NEW
96
      getByName: (...args) => repo.getByName(...args),
×
NEW
97
      removeByName: (...args) => repo.removeByName(...args),
×
NEW
98
      update: (...args) => repo.update(...args),
×
99
    };
100
  });
STATUS · Troubleshooting · Open an Issue · Sales · Support · CAREERS · ENTERPRISE · START FREE · SCHEDULE DEMO
ANNOUNCEMENTS · TWITTER · TOS & SLA · Supported CI Services · What's a CI service? · Automated Testing

© 2025 Coveralls, Inc