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

cartesi / rollups-explorer / 10559884974

26 Aug 2024 12:37PM UTC coverage: 93.391% (-0.4%) from 93.766%
10559884974

Pull #232

github

nevendyulgerov
fix(apps/web): Temporary disable swc minification
Pull Request #232: #229 Add import and export for specifications

1210 of 1432 branches covered (84.5%)

Branch coverage included in aggregate %.

487 of 570 new or added lines in 8 files covered. (85.44%)

50 existing lines in 10 files now uncovered.

12864 of 13638 relevant lines covered (94.32%)

45.58 hits per line

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

89.58
/apps/web/src/components/specification/transfer/validator.ts
1
import { validateSpecificationImport as v1Validator } from "./validators/v1";
1✔
2
import { SpecificationTransfer } from "../types";
1✔
3
import { isFunction } from "ramda-adjunct";
1✔
4

1✔
5
type Validators = Record<
1✔
6
    string,
1✔
7
    (specification: SpecificationTransfer) => Promise<void>
1✔
8
>;
1✔
9

1✔
10
const validators: Validators = {
1✔
11
    "1": v1Validator,
1✔
12
} as const;
1✔
13

1✔
14
export const VALIDATOR_VERSIONS = Object.keys(validators);
1✔
15

1✔
16
export const VALIDATOR_VERSION =
1✔
17
    VALIDATOR_VERSIONS[VALIDATOR_VERSIONS.length - 1];
1✔
18

1✔
19
export const validateSpecification = (specification: SpecificationTransfer) => {
1✔
20
    const specificationVersion = specification.version?.toString();
21✔
21

21✔
22
    return new Promise((resolve, reject) => {
21✔
23
        if (!VALIDATOR_VERSIONS.includes(specificationVersion)) {
21✔
24
            return reject([
1✔
25
                `Invalid 'version' field. Version must be of numeric value and must match one of the following values: ${VALIDATOR_VERSIONS.join(
1✔
26
                    ", ",
1✔
27
                )}.`,
1✔
28
            ]);
1✔
29
        }
1✔
30

20✔
31
        const validator =
20✔
32
            validators[specificationVersion as keyof typeof validators];
20✔
33

20✔
34
        if (!isFunction(validator)) {
21!
NEW
35
            return reject([
×
NEW
36
                "Missing validator for this specification version. Please contact support for further assistance.",
×
NEW
37
            ]);
×
NEW
38
        }
✔
39

20✔
40
        validator(specification).then(resolve).catch(reject);
20✔
41
    });
21✔
42
};
21✔
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