Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Sign in / Register
Toggle navigation
C
Challonge
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Locked Files
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Security & Compliance
Security & Compliance
Dependency List
License Compliance
Packages
Packages
List
Container Registry
Analytics
Analytics
CI / CD
Code Review
Insights
Issues
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
MyCard
Challonge
Commits
cb250a33
Commit
cb250a33
authored
Mar 14, 2017
by
Aaron Tidwell
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
add client constructor tests
parent
6d0496a1
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
71 additions
and
1 deletion
+71
-1
CHANGELOG.md
CHANGELOG.md
+7
-0
lib/api/client.js
lib/api/client.js
+1
-1
lib/api/client.spec.js
lib/api/client.spec.js
+57
-0
readme.md
readme.md
+6
-0
No files found.
CHANGELOG.md
0 → 100644
View file @
cb250a33
### 1.2a
-
Add tests (#7)
-
Fix crash on creating a client instance with no options
-
Fix challonge.createClient massageProperties is tautologically true (#2)
### 1.0
-
Initial Release
lib/api/client.js
View file @
cb250a33
...
...
@@ -16,7 +16,7 @@ var Client = exports.Client = function(options) {
if
(
!
this
.
options
.
version
)
{
this
.
options
.
version
=
1
;
}
if
(
!
this
.
options
.
massageProperties
)
{
if
(
typeof
this
.
options
.
massageProperties
===
'
undefined
'
)
{
this
.
options
.
massageProperties
=
true
;
}
if
(
!
this
.
options
.
format
)
{
...
...
lib/api/client.spec.js
0 → 100644
View file @
cb250a33
var
Client
=
require
(
'
./client
'
).
Client
;
describe
(
'
Client Class
'
,
()
=>
{
describe
(
'
constructor
'
,
()
=>
{
it
(
'
should set options to the object that is passed
'
,
()
=>
{
const
opts
=
{};
const
client
=
new
Client
(
opts
);
expect
(
client
.
options
).
toBe
(
opts
);
});
it
(
'
should default the version to 1 or use the number passed
'
,
()
=>
{
expect
(
new
Client
().
options
.
version
).
toBe
(
1
);
expect
(
new
Client
({
version
:
10
}).
options
.
version
).
toBe
(
10
);
});
it
(
'
should set massageProperties to true by default, or override to false if passed
'
,
()
=>
{
expect
(
new
Client
().
options
.
massageProperties
).
toBe
(
true
);
expect
(
new
Client
({
massageProperties
:
false
}).
options
.
massageProperties
).
toBe
(
false
);
});
it
(
'
should set the format to json by default, or override if passed
'
,
()
=>
{
expect
(
new
Client
().
options
.
format
).
toBe
(
'
json
'
);
expect
(
new
Client
({
format
:
'
xml
'
}).
options
.
format
).
toBe
(
'
xml
'
);
});
it
(
'
should set the subdomain to whatever was passed
'
,
()
=>
{
spyOn
(
Client
.
prototype
,
'
setSubdomain
'
);
const
client
=
new
Client
({
subdomain
:
'
somedomain
'
});
expect
(
Client
.
prototype
.
setSubdomain
).
toHaveBeenCalledWith
(
'
somedomain
'
);
});
it
(
'
should attach a getter to the options object
'
,
()
=>
{
const
client
=
new
Client
();
expect
(
typeof
client
.
options
.
get
).
toBe
(
'
function
'
);
});
it
(
'
should attach a getter to the options object
'
,
()
=>
{
const
client
=
new
Client
();
expect
(
typeof
client
.
options
.
get
).
toBe
(
'
function
'
);
client
.
options
.
someProp
=
'
someVal
'
;
expect
(
client
.
options
.
get
(
'
someProp
'
)).
toBe
(
'
someVal
'
);
});
});
});
readme.md
View file @
cb250a33
## Usage
### Install
```
bash
$
npm
install
challonge
--save
```
### Get all tournaments on your account
```
js
...
...
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