• 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

66.67
/packages/server-cli/src/dependencies/in-memory/tag.repository.ts
1
import { switchExpandItems } from '@ckapp/rxjs-snafu/lib/cjs/array/operators';
2✔
2
import { Context, createReader } from '@marblejs/core';
2✔
3
import { Reader } from 'fp-ts/lib/Reader';
4
import { Observable, of } from 'rxjs';
2✔
5
import { take, withLatestFrom } from 'rxjs/operators';
2✔
6

7
import { BaseTag, Tag, TagQuery } from '@overckd/domain';
8
import { TagRepository } from '@overckd/domain/dist/repositories';
9
import { filterTagsByQuery } from '@overckd/domain/dist/rxjs/tag';
2✔
10
import { asPagedResult } from '@overckd/domain/dist/rxjs/search';
2✔
11
import { Page } from '@overckd/domain/dist/search';
12

13
import { UriFactory } from './utils';
2✔
14
import { InMemoryRepo } from './in-memory-repo';
2✔
15

16
const uri = UriFactory(['tags']);
2✔
17

18
function makeTag(label: string, color?: string, icon?: string): Tag {
19
  return {
16✔
20
    label,
21
    color,
22
    icon,
23
    uri: uri(label),
24
  };
25
}
26

27
class TagRepo extends InMemoryRepo<Tag> implements TagRepository {
28
  add(tag: BaseTag): Observable<Tag> {
29
    return this._add(tag);
×
30
  }
31
  removeByUri(uri: string): Observable<Tag> {
32
    return this._remove({ uri });
×
33
  }
34
  getByUri(uri: string): Observable<Tag | undefined> {
35
    return this.findItem({ uri });
×
36
  }
37
  update(uri: string, tag: Tag): Observable<Tag | undefined> {
38
    return this._update(tag);
×
39
  }
40
  findByQuery(query: TagQuery): Observable<Page<Tag>> {
41
    const query$ = of(query);
2✔
42
    const items$ = this.all.pipe(take(1), switchExpandItems());
2✔
43

44
    return items$.pipe(
2✔
45
      withLatestFrom(query$),
46
      filterTagsByQuery(),
47
      asPagedResult(),
48
    );
49
  }
50

51
  equals(a: Tag, b: Tag): boolean {
52
    return a.uri === b.uri;
×
53
  }
54
}
55

56
export const MockTagRespository: Reader<Context, TagRepository> =
2✔
57
  createReader<TagRepository>(() => {
58
    const initialValue = [
4✔
59
      makeTag('vegan', '#117935', 'leaf'),
60
      makeTag('vegetables', '#117935', 'leaf'),
61
      makeTag('fruit', '#117935', 'apple-alt'),
62
      makeTag('root vegetable', '#794c11', 'carrot'),
63
    ];
64
    const repo = new TagRepo(initialValue);
4✔
65

66
    return {
4✔
NEW
67
      add: (...args) => repo.add(...args),
×
NEW
68
      getByUri: (...args) => repo.getByUri(...args),
×
69
      findByQuery: (...args) => repo.findByQuery(...args),
2✔
NEW
70
      removeByUri: (...args) => repo.removeByUri(...args),
×
NEW
71
      update: (...args) => repo.update(...args),
×
72
    };
73
  });
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