Skip to content
GitLab
Menu
Projects
Groups
Snippets
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
SRCT
lib-ical
Commits
6d80477a
Commit
6d80477a
authored
Feb 21, 2017
by
Mark Stenglein
Browse files
All tests written to current development point
- Onward to greater page numbers in the RFC!
parent
6b029687
Pipeline
#929
passed with stage
in 16 seconds
Changes
1
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
test/Parameter.spec.ts
View file @
6d80477a
...
...
@@ -106,17 +106,41 @@ describe("Parameter", () => {
});
});
describe
(
"
***
paramValues
"
,
()
=>
{
describe
(
"
paramValues
"
,
()
=>
{
it
(
"
Correctly sets paramtext values
"
,
()
=>
{
const
name
:
string
=
"
TEST
"
;
const
values
:
string
[]
=
[
"
value
"
,
"
value2
"
];
const
param
:
Parameter
=
new
Parameter
(
name
,
values
);
const
result
:
string
[]
=
param
.
paramValues
;
expect
(
result
).
to
.
deep
.
equal
(
values
);
});
it
(
"
Correctly sets quoted-string values
"
,
()
=>
{
const
name
:
string
=
"
TEST
"
;
const
values
:
string
[]
=
[
"
\"
value
\"
"
,
"
\"
value2
\"
"
];
const
param
:
Parameter
=
new
Parameter
(
name
,
values
);
const
result
:
string
[]
=
param
.
paramValues
;
expect
(
result
).
to
.
deep
.
equal
(
values
);
});
it
(
"
Throws an exception on malformed string
"
,
()
=>
{
it
(
"
Correctly sets mixed type values
"
,
()
=>
{
const
name
:
string
=
"
TEST
"
;
const
values
:
string
[]
=
[
"
value
"
,
"
\"
value2
\"
"
];
const
param
:
Parameter
=
new
Parameter
(
name
,
values
);
const
result
:
string
[]
=
param
.
paramValues
;
expect
(
result
).
to
.
deep
.
equal
(
values
);
});
it
(
"
Throws an exception on malformed string
"
,
()
=>
{
expect
(()
=>
{
const
name
:
string
=
"
TEST
"
;
const
values
:
string
[]
=
[
"
V#
\"
!UE
"
];
const
param
:
Parameter
=
new
Parameter
(
name
,
values
);
}).
to
.
throw
(
"
param-value must either be valid paramtext or
"
+
"
quoted-string
"
);
});
});
});
...
...
@@ -136,15 +160,28 @@ describe("Parameter", () => {
*/
describe
(
"
***generate()
"
,
()
=>
{
it
(
"
Correctly generates single-valued parameters
"
,
()
=>
{
const
param
:
Parameter
=
new
Parameter
(
"
NAME
"
,
[
"
value1
"
]);
const
result
:
string
=
param
.
generate
();
const
expected
:
string
=
"
NAME=value1
"
;
expect
(
result
).
to
.
be
.
equal
(
expected
);
});
it
(
"
Correctly generates double-valued parameters
"
,
()
=>
{
const
param
:
Parameter
=
new
Parameter
(
"
NAME
"
,
[
"
value1
"
,
"
value2
"
]);
const
result
:
string
=
param
.
generate
();
const
expected
:
string
=
"
NAME=value1,value2
"
;
expect
(
result
).
to
.
be
.
equal
(
expected
);
});
it
(
"
Correctly generates multi-valued parameters
"
,
()
=>
{
const
param
:
Parameter
=
new
Parameter
(
"
NAME
"
,
[
"
value1
"
,
"
value2
"
,
"
value3
"
]);
const
result
:
string
=
param
.
generate
();
const
expected
:
string
=
"
NAME=value1,value2,value3
"
;
expect
(
result
).
to
.
be
.
equal
(
expected
);
});
});
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment