-
Notifications
You must be signed in to change notification settings - Fork 1
/
version.spec.lua
57 lines (46 loc) · 1.47 KB
/
version.spec.lua
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
--[[
* Copyright (c) GraphQL Contributors
*
* This source code is licensed under the MIT license found in the
* LICENSE file in the root directory of this source tree.
]]
-- ROBLOX upstream: https://github.com/graphql/graphql-js/blob/00d4efea7f5b44088356798afff0317880605f4d/src/__tests__/version-test.js
return function()
local srcWorkspace = script.Parent.Parent
local Object = require(srcWorkspace.Parent.LuauPolyfill).Object
local versionModule = require(script.Parent.Parent.version)
local version = versionModule.version
local versionInfo = versionModule.versionInfo
describe("Version", function()
it("version", function()
expect(version).to.be.a("string")
-- ROBLOX deviation: skip complicated regex
end)
it("versionInfo", function()
local expect: any = expect
expect(versionInfo).to.be.a("table")
expect(Object.keys(versionInfo)).toHaveSameMembers({
"major",
"minor",
"patch",
"preReleaseTag",
})
local major = versionInfo.major
local minor = versionInfo.minor
local patch = versionInfo.patch
local preReleaseTag = versionInfo.preReleaseTag
expect(major).to.be.a("number")
expect(minor).to.be.a("number")
expect(patch).to.be.a("number")
if preReleaseTag ~= "" then
expect(preReleaseTag).to.be.a("string")
end
expect(("%d.%d.%d"):format(major, minor, patch) .. (function()
if preReleaseTag ~= "" then
return "-" .. preReleaseTag
end
return ""
end)()).to.equal(version)
end)
end)
end