2022-07-31 19:05:40 +02:00
|
|
|
"use strict";
|
|
|
|
|
2024-10-09 00:25:41 +02:00
|
|
|
const assert = require("node:assert/strict");
|
2022-07-31 19:05:40 +02:00
|
|
|
|
2023-02-22 23:04:10 +01:00
|
|
|
const {zrequire} = require("./lib/namespace");
|
|
|
|
const {run_test} = require("./lib/test");
|
2022-07-31 19:05:40 +02:00
|
|
|
|
2023-10-12 23:23:55 +02:00
|
|
|
const gear_menu_util = zrequire("gear_menu_util");
|
2024-10-09 22:44:13 +02:00
|
|
|
const {set_realm} = zrequire("state_data");
|
|
|
|
|
|
|
|
const realm = {};
|
|
|
|
set_realm(realm);
|
2022-07-31 19:05:40 +02:00
|
|
|
|
2024-10-09 22:20:06 +02:00
|
|
|
run_test("version_display_string", ({override}) => {
|
2022-07-31 19:05:40 +02:00
|
|
|
let expected_version_display_string;
|
|
|
|
|
|
|
|
// An official release
|
2024-10-09 22:20:06 +02:00
|
|
|
override(realm, "zulip_version", "5.6");
|
|
|
|
override(realm, "zulip_merge_base", "5.6");
|
2022-07-31 19:05:40 +02:00
|
|
|
expected_version_display_string = "translated: Zulip Server 5.6";
|
2023-10-12 23:23:55 +02:00
|
|
|
assert.equal(gear_menu_util.version_display_string(), expected_version_display_string);
|
2022-07-31 19:05:40 +02:00
|
|
|
|
|
|
|
// An official beta
|
2024-10-09 22:20:06 +02:00
|
|
|
override(realm, "zulip_version", "6.0-beta1");
|
|
|
|
override(realm, "zulip_merge_base", "6.0-beta1");
|
2022-07-31 19:05:40 +02:00
|
|
|
expected_version_display_string = "translated: Zulip Server 6.0-beta1";
|
2023-10-12 23:23:55 +02:00
|
|
|
assert.equal(gear_menu_util.version_display_string(), expected_version_display_string);
|
2022-07-31 19:05:40 +02:00
|
|
|
|
|
|
|
// An official release candidate
|
2024-10-09 22:20:06 +02:00
|
|
|
override(realm, "zulip_version", "6.0-rc1");
|
|
|
|
override(realm, "zulip_merge_base", "6.0-rc1");
|
2022-07-31 19:05:40 +02:00
|
|
|
expected_version_display_string = "translated: Zulip Server 6.0-rc1";
|
2023-10-12 23:23:55 +02:00
|
|
|
assert.equal(gear_menu_util.version_display_string(), expected_version_display_string);
|
2022-07-31 19:05:40 +02:00
|
|
|
|
|
|
|
// The Zulip development environment
|
2024-10-09 22:20:06 +02:00
|
|
|
override(realm, "zulip_version", "6.0-dev+git");
|
|
|
|
override(realm, "zulip_merge_base", "6.0-dev+git");
|
2022-07-31 19:05:40 +02:00
|
|
|
expected_version_display_string = "translated: Zulip Server dev environment";
|
2023-10-12 23:23:55 +02:00
|
|
|
assert.equal(gear_menu_util.version_display_string(), expected_version_display_string);
|
2022-07-31 19:05:40 +02:00
|
|
|
|
|
|
|
// A commit on Zulip's main branch.
|
2024-10-09 22:20:06 +02:00
|
|
|
override(realm, "zulip_version", "6.0-dev-1976-g4bb381fc80");
|
|
|
|
override(realm, "zulip_merge_base", "6.0-dev-1976-g4bb381fc80");
|
2022-07-31 19:05:40 +02:00
|
|
|
expected_version_display_string = "translated: Zulip Server 6.0-dev";
|
2023-10-12 23:23:55 +02:00
|
|
|
assert.equal(gear_menu_util.version_display_string(), expected_version_display_string);
|
2022-07-31 19:05:40 +02:00
|
|
|
|
|
|
|
// A fork with 18 commits beyond Zulip's main branch.
|
2024-10-09 22:20:06 +02:00
|
|
|
override(realm, "zulip_version", "6.0-dev-1994-g93730766b0");
|
|
|
|
override(realm, "zulip_merge_base", "6.0-dev-1976-g4bb381fc80");
|
2022-07-31 19:05:40 +02:00
|
|
|
expected_version_display_string = "translated: Zulip Server 6.0-dev (modified)";
|
2023-10-12 23:23:55 +02:00
|
|
|
assert.equal(gear_menu_util.version_display_string(), expected_version_display_string);
|
2022-07-31 19:05:40 +02:00
|
|
|
|
|
|
|
// A commit from the Zulip 5.x branch
|
2024-10-09 22:20:06 +02:00
|
|
|
override(realm, "zulip_version", "5.6+git-4-g385a408be5");
|
|
|
|
override(realm, "zulip_merge_base", "5.6+git-4-g385a408be5");
|
2022-07-31 19:05:40 +02:00
|
|
|
expected_version_display_string = "translated: Zulip Server 5.6 (patched)";
|
2023-10-12 23:23:55 +02:00
|
|
|
assert.equal(gear_menu_util.version_display_string(), expected_version_display_string);
|
2022-07-31 19:05:40 +02:00
|
|
|
|
|
|
|
// A fork with 3 commits beyond the Zulip 5.x branch.
|
2024-10-09 22:20:06 +02:00
|
|
|
override(realm, "zulip_version", "5.6+git-4-g385a408be5");
|
|
|
|
override(realm, "zulip_merge_base", "5.6+git-7-abcda4235c2");
|
2022-07-31 19:05:40 +02:00
|
|
|
expected_version_display_string = "translated: Zulip Server 5.6 (modified)";
|
2023-10-12 23:23:55 +02:00
|
|
|
assert.equal(gear_menu_util.version_display_string(), expected_version_display_string);
|
2022-07-31 19:05:40 +02:00
|
|
|
|
|
|
|
// A fork of a Zulip release commit, not on 5.x branch.
|
2024-10-09 22:20:06 +02:00
|
|
|
override(realm, "zulip_version", "5.3-1-g7ed896c0db");
|
|
|
|
override(realm, "zulip_merge_base", "5.3");
|
2022-07-31 19:05:40 +02:00
|
|
|
expected_version_display_string = "translated: Zulip Server 5.3 (modified)";
|
2023-10-12 23:23:55 +02:00
|
|
|
assert.equal(gear_menu_util.version_display_string(), expected_version_display_string);
|
2022-07-31 19:05:40 +02:00
|
|
|
});
|