{"size": 5170, "ext": "js", "max_stars_repo_path": "app/contact-app/contact-webapp/src/main/webapp/extjs/sdk/src/core/test/unit/spec/version/Version.js", "max_stars_repo_name": "hiya492/spring", "max_stars_repo_stars_event_min_datetime": "2015-01-11T16:07:13.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-29T13:19:50.000Z", "max_issues_repo_path": "app/contact-app/contact-webapp/src/main/webapp/extjs/sdk/src/core/test/unit/spec/version/Version.js", "max_issues_repo_name": "hiya492/spring", "max_issues_repo_issues_event_min_datetime": "2017-04-24T23:36:43.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-10T15:41:23.000Z", "max_forks_repo_path": "app/contact-app/contact-webapp/src/main/webapp/extjs/sdk/src/core/test/unit/spec/version/Version.js", "max_forks_repo_name": "hiya492/spring", "max_forks_repo_forks_event_min_datetime": "2015-01-05T12:54:49.000Z", "max_forks_repo_forks_event_max_datetime": "2021-09-24T11:00:33.000Z"}
{"max_stars_count": 213, "max_issues_count": 8, "max_forks_count": 250, "avg_line_length": 34.6979865772, "max_line_length": 79, "alphanum_fraction": 0.5087040619}
describe("Ext.Version", function() {
    var version = new Ext.Version("1.2.3beta");

    describe("toString", function() {
        it("should cast to string", function() {
            expect(version+"").toBe("1.2.3beta");
        });
    });

    describe("getMajor", function() {
        it("should return 1", function() {
            expect(version.getMajor()).toBe(1);
        });
    });

    describe("getMinor", function() {
        it("should return 2", function() {
            expect(version.getMinor()).toBe(2);
        });
    });

    describe("getPatch", function() {
        it("should return 3", function() {
            expect(version.getPatch()).toBe(3);
        });
    });

    describe("getBuild", function() {
        it("should return 0", function() {
            expect(version.getBuild()).toBe(0);
        });
    });

    describe("getRelease", function() {
        it("should return beta", function() {
            expect(version.getRelease()).toBe("beta");
        });
    });

    describe("getShortVersion", function() {
        it("should return 123", function() {
            expect(version.getShortVersion()).toBe("123");
        });
    });

    describe("toArray", function() {
        it("should return [1, 2, 3, 0, 'beta']", function() {
            expect(version.toArray()).toEqual([1, 2, 3, 0, 'beta']);
        });
    });

    describe("isGreaterThan", function() {
        it("should be greater than 1.2.3alpha", function() {
            expect(version.isGreaterThan("1.2.3alpha")).toBeTruthy();
        });
        it("should not be greater than 1.2.3RC", function() {
            expect(version.isGreaterThan("1.2.3RC")).toBeFalsy();
        });
    });

    describe("isLessThan", function() {
        it("should not be smaller than 1.2.3alpha", function() {
            expect(version.isLessThan("1.2.3alpha")).toBeFalsy();
        });
        it("should be smaller than 1.2.3RC", function() {
            expect(version.isLessThan("1.2.3RC")).toBeTruthy();
        });
    });

    describe("equals", function() {
        it("should equals 1.2.3beta", function() {
            expect(version.equals("1.2.3beta")).toBeTruthy();
        });
    });

    describe("match", function() {
        it("should match integer 1", function() {
            expect(version.match(1)).toBeTruthy();
        });
        it("should match float 1.2", function() {
                expect(version.match(1.2)).toBeTruthy();
        });
        it("should match string 1.2.3", function() {
            expect(version.match("1.2.3")).toBeTruthy();
        });
        it("should not match string 1.2.3alpha", function() {
            expect(version.match("1.2.3alpha")).toBeFalsy();
        });
    });
    
   describe("setVersion", function() {
        it("should return an instance of Ext.Version", function() {
            Ext.setVersion("test", "1.0.1");
            expect(Ext.getVersion("test") instanceof Ext.Version).toBe(true);
        });
    });
    
    describe("statics", function() {
        describe("getComponentValue", function() {
            it("should return 0", function() {
            expect(Ext.Version.getComponentValue(undefined)).toBe(0);
            });

            it("should return -2", function() {
            expect(Ext.Version.getComponentValue(-2)).toBe(-2);
            });

            it("should return 2", function() {
            expect(Ext.Version.getComponentValue("2")).toBe(2);
            });

            it("should return -5", function() {
            expect(Ext.Version.getComponentValue("alpha")).toBe(-5);
            });

            it("should return unknown", function() {
            expect(Ext.Version.getComponentValue("unknown")).toBe("unknown");
            });
        });

        describe("compare", function() {
            it("should return 1", function() {
                expect(Ext.Version.compare("1.2.3beta", "1.2.2")).toBe(1);
                expect(Ext.Version.compare("1.2.3beta", 1)).toBe(1);
                expect(Ext.Version.compare("1.2.3beta", "1.2.3dev")).toBe(1);
                expect(Ext.Version.compare("1.2.3beta", "1.2.3alpha")).toBe(1);
                expect(Ext.Version.compare("1.2.3beta", "1.2.3a")).toBe(1);
                expect(Ext.Version.compare("1.2.3beta", "1.2.3alpha")).toBe(1);
            });


            it("should return -1", function() {
                expect(Ext.Version.compare("1.2.3beta", 2)).toBe(-1);
                expect(Ext.Version.compare("1.2.3beta", "1.2.4")).toBe(-1);
                expect(Ext.Version.compare("1.2.3beta", "1.2.3RC")).toBe(-1);
                expect(Ext.Version.compare("1.2.3beta", "1.2.3rc")).toBe(-1);
                expect(Ext.Version.compare("1.2.3beta", "1.2.3#")).toBe(-1);
                expect(Ext.Version.compare("1.2.3beta", "1.2.3pl")).toBe(-1);
                expect(Ext.Version.compare("1.2.3beta", "1.2.3p")).toBe(-1);
            });

            it("should return 0", function() {
                expect(Ext.Version.compare("1.2.3beta", "1.2.3b")).toBe(0);
                expect(Ext.Version.compare("1.2.3beta", "1.2.3beta")).toBe(0);
            });
        });    
    });
});
