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

nikelborm / fetch-github-folder / 12804526304

16 Jan 2025 08:03AM UTC coverage: 56.577% (+0.2%) from 56.366%
12804526304

push

github

nikelborm
quick save: Thu Jan 16 11:03:21 MSK 2025

47 of 59 branches covered (79.66%)

Branch coverage included in aggregate %.

0 of 1 new or added line in 1 file covered. (0.0%)

75 existing lines in 8 files now uncovered.

310 of 572 relevant lines covered (54.2%)

2.37 hits per line

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

93.75
/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(function* () {
1✔
18
  const response = yield* requestRepoPathContentsFromGitHubAPI("object")
14✔
19
    .pipe(TapLogBoth);
14✔
20

21
  return yield* mapLeft(
7✔
22
    decodeResponse(response.data),
7✔
23
    parseError => new FailedToParseResponseFromRepoPathContentsMetaInfoAPI(
7✔
UNCOV
24
      parseError,
×
UNCOV
25
      { response }
×
UNCOV
26
    )
×
27
  );
7✔
28
});
7✔
29

30
const GitSomethingFields = {
1✔
31
  size: SchemaNumber,
1✔
32
  name: SchemaString,
1✔
33
  path: SchemaString,
1✔
34
  sha: SchemaString,
1✔
35
}
1✔
36

37
const dirLiteral = Literal('dir');
1✔
38
const nonDirLiterals = Literal('file', 'submodule', 'symlink');
1✔
39

40
export const ResponseSchema = Union(
1✔
41
  Struct({
1✔
42
    type: Literal('dir'),
1✔
43
    entries: Struct({
1✔
44
      type: Union(dirLiteral, nonDirLiterals),
1✔
45
      ...GitSomethingFields,
1✔
46
    }).pipe(ArraySchema),
1✔
47
    ...GitSomethingFields
1✔
48
  }),
1✔
49
  Struct({
1✔
50
    type: Literal('file'),
1✔
51
    encoding: Literal('base64', 'none'),
1✔
52
    content: SchemaString,
1✔
53
    ...GitSomethingFields,
1✔
54
  })
1✔
55
)
1✔
56

57
const decodeResponse = decodeUnknownEither(
1✔
58
  ResponseSchema,
1✔
59
  { exact: true }
1✔
60
);
1✔
61

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