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

wanasit / chrono / 9329503257

01 Jun 2024 10:10AM UTC coverage: 91.432% (+0.01%) from 91.421%
9329503257

push

github

Wanasit Tanakitrungruang
Fix: Failing unittest on UTC timezone

1436 of 1820 branches covered (78.9%)

4418 of 4832 relevant lines covered (91.43%)

400.47 hits per line

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

67.86
/src/common/refiners/UnlikelyFormatFilter.ts
1
import { Filter } from "../abstractRefiners";
90✔
2
import { ParsingResult } from "../../results";
3

4
export default class UnlikelyFormatFilter extends Filter {
90✔
5
    constructor(private strictMode: boolean) {
2,253✔
6
        super();
2,253✔
7
    }
8

9
    isValid(context, result: ParsingResult): boolean {
10
        if (result.text.replace(" ", "").match(/^\d*(\.\d*)?$/)) {
1,533✔
11
            context.debug(() => {
28✔
12
                console.log(`Removing unlikely result '${result.text}'`);
×
13
            });
14

15
            return false;
28✔
16
        }
17

18
        if (!result.start.isValidDate()) {
1,505✔
19
            context.debug(() => {
21✔
20
                console.log(`Removing invalid result: ${result} (${result.start})`);
×
21
            });
22

23
            return false;
21✔
24
        }
25

26
        if (result.end && !result.end.isValidDate()) {
1,484!
27
            context.debug(() => {
×
28
                console.log(`Removing invalid result: ${result} (${result.end})`);
×
29
            });
30

31
            return false;
×
32
        }
33

34
        if (this.strictMode) {
1,484✔
35
            return this.isStrictModeValid(context, result);
22✔
36
        }
37

38
        return true;
1,462✔
39
    }
40

41
    private isStrictModeValid(context, result: ParsingResult) {
42
        if (result.start.isOnlyWeekdayComponent()) {
22✔
43
            context.debug(() => {
1✔
44
                console.log(`(Strict) Removing weekday only component: ${result} (${result.end})`);
×
45
            });
46

47
            return false;
1✔
48
        }
49

50
        if (result.start.isOnlyTime() && (!result.start.isCertain("hour") || !result.start.isCertain("minute"))) {
21!
51
            context.debug(() => {
×
52
                console.log(`(Strict) Removing uncertain time component: ${result} (${result.end})`);
×
53
            });
54

55
            return false;
×
56
        }
57

58
        return true;
21✔
59
    }
60
}
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