-
Notifications
You must be signed in to change notification settings - Fork 19
Expand file tree
/
Copy pathmssql.spec.js
More file actions
142 lines (109 loc) · 4.15 KB
/
Copy pathmssql.spec.js
File metadata and controls
142 lines (109 loc) · 4.15 KB
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
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
var createFilter = require('../lib').createFilter
var expect = require('chai').expect
describe("SQL WHERE useParameters (MS-SQL)", () => {
var f;
beforeEach(function() {
var match;
if (match = this.currentTest.title.match(/expression[^\:]*\: ?(.*)/)) {
f = createFilter(match[1], {
useParameters: true,
type: 1
});
}
});
//all numbers are referencing this:
//http://docs.oasis-open.org/odata/odata/v4.0/errata02/os/complete/part2-url-conventions/odata-v4.0-errata02-os-part2-url-conventions-complete.html#_Toc406398116
it("expression 5.1.1.6.1: NullValue eq null", () => {
expect(f.where).to.equal("[NullValue] IS NULL")
})
it("expression 5.1.1.6.1: TrueValue eq true", () => {
expect(f.where).to.equal("[TrueValue] = @p0")
})
it("expression 5.1.1.6.1: FalseValue eq false", () => {
expect(f.where).to.equal("[FalseValue] = @p0")
})
it("expression 5.1.1.6.1: IntegerValue lt -128", () => {
expect(f.where).to.equal("[IntegerValue] < @p0")
})
it("expression 5.1.1.6.1: DecimalValue eq 34.95", () => {
expect(f.where).to.equal("[DecimalValue] = @p0")
})
it("expression 5.1.1.6.1: StringValue eq 'Say Hello,then go'", () => {
expect(f.where).to.equal("[StringValue] = @p0")
})
it("expression 5.1.1.6.1: DurationValue eq duration'P12DT23H59M59.999999999999S'", () => {
expect(f.where).to.equal("[DurationValue] = @p0")
})
it("expression 5.1.1.6.1: DateValue eq 2012-12-03", () => {
expect(f.where).to.equal("[DateValue] = @p0")
})
it("expression 5.1.1.6.1: DateTimeOffsetValue eq 2012-12-03T07:16:23Z", () => {
expect(f.where).to.equal("[DateTimeOffsetValue] = @p0")
})
it("expression 5.1.1.6.1: GuidValue eq 01234567-89ab-cdef-0123-456789abcdef", () => {
expect(f.where).to.equal("[GuidValue] = @p0")
})
it("expression 5.1.1.6.1: Int64Value eq 0", () => {
expect(f.where).to.equal("[Int64Value] = @p0")
})
it("expression 5.1.1.6.1: A eq 0.31415926535897931e1", () => {
expect(f.where).to.equal("[A] = @p0")
})
it("expression 5.1.1.1.2: A ne 1", () => {
expect(f.where).to.equal("[A] <> @p0")
})
it("expression 5.1.1.1.3: A gt 2", () => {
expect(f.where).to.equal("[A] > @p0")
})
it("expression 5.1.1.1.4: A ge 3", () => {
expect(f.where).to.equal("[A] >= @p0")
})
it("expression 5.1.1.1.5: A lt 2", () => {
expect(f.where).to.equal("[A] < @p0")
})
it("expression 5.1.1.1.6: A le 2", () => {
expect(f.where).to.equal("[A] <= @p0")
})
it("expression 5.1.1.3: (A eq 2) or (B lt 4) and ((E gt 5) or (E lt -1))", () => {
expect(f.where).to.equal("([A] = @p0) OR ([B] < @p1) AND (([E] > @p2) OR ([E] < @p3))")
})
it("expression 5.1.1.4.1: contains(A, 'BC')", () => {
expect(f.where).to.equal("[A] like @p0");
})
it("expression 5.1.1.4.2: endswith(A, 'CD')", () => {
expect(f.where).to.equal("[A] like @p0");
})
it("expression 5.1.1.4.3: startswith(A, 'CD')", () => {
expect(f.where).to.equal("[A] like @p0");
})
it("expression 5.1.1.4.4: length(A) eq 3", () => {
expect(f.where).to.equal("LEN([A]) = @p0")
})
it("expression 5.1.1.4.5: indexof(A, 'BC') eq 1", () => {
expect(f.where).to.equal("CHARINDEX(@p0, [A]) - 1 = @p1")
})
it("expression 5.1.1.4.7: tolower(A) eq 'abc'", () => {
expect(f.where).to.equal("LOWER([A]) = @p0")
})
it("expression 5.1.1.4.8: toupper(A) eq 'ABC'", () => {
expect(f.where).to.equal("UPPER([A]) = @p0")
})
it("expression 5.1.1.4.9: trim(A) eq 'abc'", () => {
expect(f.where).to.equal("TRIM(' ' FROM [A]) = @p0")
})
it("expression 5.1.1.4.11: A eq year(2016-01-01T13:00Z)", () => {
expect(f.where).to.equal("[A] = YEAR(@p0)")
})
it("expression 5.1.1.4.21: year(now())", () => {
expect(f.where).to.equal("YEAR(NOW())")
})
it("expression 5.1.1.4.25: round(A) eq 42", () => {
expect(f.where).to.equal("ROUND([A]) = @p0")
})
it("expression 5.1.1.4.26: floor(A) eq 42", () => {
expect(f.where).to.equal("FLOOR([A]) = @p0")
})
it("expression 5.1.1.4.27: ceiling(A) eq 42", () => {
expect(f.where).to.equal("CEILING([A]) = @p0")
})
})