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

NationalBankBelgium / stark / 9205123826

23 May 2024 08:55AM CUT coverage: 88.822%. Remained the same
9205123826

Pull #3800

github

web-flow
Merge 5208cd19f into 59c39b170
Pull Request #3800: chore(deps): bump zone.js from 0.11.8 to 0.14.6 in /showcase

1260 of 1528 branches covered (82.46%)

Branch coverage included in aggregate %.

3770 of 4135 relevant lines covered (91.17%)

193.16 hits per line

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

38.46
/packages/stark-core/src/configuration/entities/language/language.entity.ts
1
import { IsNotEmpty, IsString, Matches } from "class-validator";
2
import { autoserialize } from "cerialize";
3
import { StarkLanguage } from "./language.entity.intf";
4
import { StarkIsSupportedLanguage } from "../../../validation/decorators/is-supported-language";
5

6
/**
7
 * This class is only for serialization purposes
8
 * @ignore
9
 */
10
export class StarkLanguageImpl implements StarkLanguage {
11
        /**
12
         * Extracted regex as a workaround to avoid Angular compiler error: "Expression form not supported" due to the
13
         * regex passed to the `@Matches` decorator in the `isoCode` property of this class.
14
         *
15
         * Using simple string instead of RegExp string since the compiler has a restricted expression syntax.
16
         * See https://v12.angular.io/guide/aot-compiler#expression-syntax
17
         */
18
        private static languageIsoCodeRegex = new RegExp("^[a-z]{2}-[A-Z]{2}$");
1✔
19

20
        @IsNotEmpty({ always: true }) // validation must be performed always, regardless of validation groups used.
21
        @IsString({ always: true })
22
        @Matches(StarkLanguageImpl.languageIsoCodeRegex, { always: true })
23
        @StarkIsSupportedLanguage({ always: true })
24
        @autoserialize
25
        public isoCode: string;
1✔
26

27
        @IsNotEmpty({ always: true }) // validation must be performed always, regardless of validation groups used.
28
        @IsString({ always: true })
29
        @autoserialize
30
        public translationKey: string;
1✔
31

32
        public constructor(isoCode: string, translationKey: string) {
33
                this.isoCode = isoCode;
9✔
34
                this.translationKey = translationKey;
9✔
35
        }
36

37
        public get code(): string {
38
                if (this.isoCode.length === 5) {
×
39
                        return this.isoCode.substr(0, 2);
×
40
                }
41
                return "";
×
42
        }
43

44
        public get region(): string {
45
                if (this.isoCode.length === 5) {
×
46
                        return this.isoCode.substr(3, 2);
×
47
                }
48
                return "";
×
49
        }
50
}
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