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

nikelborm / fetch-github-folder / 12804827031

16 Jan 2025 08:22AM UTC coverage: 55.394% (-1.2%) from 56.577%
12804827031

push

github

nikelborm
quick save: Thu Jan 16 11:22:57 MSK 2025

51 of 64 branches covered (79.69%)

Branch coverage included in aggregate %.

178 of 408 new or added lines in 15 files covered. (43.63%)

5 existing lines in 1 file now uncovered.

329 of 622 relevant lines covered (52.89%)

2.32 hits per line

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

92.31
/src/getPathContents/requestMetaInfoAboutPathContentsFromGitHubAPI.ts
1
import { gen } from 'effect/Effect';
1✔
2
import { mapLeft } from 'effect/Either';
3
import { ParseError } from 'effect/ParseResult';
4
import {
5
  Array as ArraySchema,
6
  decodeUnknownEither,
7
  Literal,
8
  Number as SchemaNumber,
9
  String as SchemaString,
10
  Struct,
11
  Union,
12
} from 'effect/Schema';
13
import { TaggedErrorVerifyingCause } from '../TaggedErrorVerifyingCause.js';
14
import { TapLogBoth } from '../TapLogBoth.js';
15
import { requestRepoPathContentsFromGitHubAPI } from './requestRepoPathContentsFromGitHubAPI.js';
16

17
export const requestMetaInfoAboutPathContentsFromGitHubAPI = gen(
1✔
18
  function* () {
1✔
19
    const response =
14✔
20
      yield* requestRepoPathContentsFromGitHubAPI('object').pipe(
14✔
21
        TapLogBoth,
14✔
22
      );
14✔
23

24
    return yield* mapLeft(
7✔
25
      decodeResponse(response.data),
7✔
26
      parseError =>
7✔
NEW
27
        new FailedToParseResponseFromRepoPathContentsMetaInfoAPI(
×
NEW
28
          parseError,
×
NEW
29
          { response },
×
NEW
30
        ),
×
31
    );
7✔
32
  },
14✔
33
);
1✔
34

35
const GitSomethingFields = {
1✔
36
  size: SchemaNumber,
1✔
37
  name: SchemaString,
1✔
38
  path: SchemaString,
1✔
39
  sha: SchemaString,
1✔
40
};
1✔
41

42
const dirLiteral = Literal('dir');
1✔
43
const nonDirLiterals = Literal('file', 'submodule', 'symlink');
1✔
44

45
export const ResponseSchema = Union(
1✔
46
  Struct({
1✔
47
    type: Literal('dir'),
1✔
48
    entries: Struct({
1✔
49
      type: Union(dirLiteral, nonDirLiterals),
1✔
50
      ...GitSomethingFields,
1✔
51
    }).pipe(ArraySchema),
1✔
52
    ...GitSomethingFields,
1✔
53
  }),
1✔
54
  Struct({
1✔
55
    type: Literal('file'),
1✔
56
    encoding: Literal('base64', 'none'),
1✔
57
    content: SchemaString,
1✔
58
    ...GitSomethingFields,
1✔
59
  }),
1✔
60
);
1✔
61

62
const decodeResponse = decodeUnknownEither(ResponseSchema, {
1✔
63
  exact: true,
1✔
64
});
1✔
65

66
export class FailedToParseResponseFromRepoPathContentsMetaInfoAPI extends TaggedErrorVerifyingCause<{
1✔
67
  response: unknown;
68
}>()(
1✔
69
  'FailedToParseResponseFromRepoPathContentsMetaInfoAPI',
1✔
70
  `Failed to parse response from repo path contents meta info API`,
1✔
71
  ParseError,
1✔
72
) {}
1✔
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

© 2026 Coveralls, Inc