Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
G
generateur-slogans
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
2
Issues
2
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
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
LQDN Adminsys
generateur-slogans
Commits
3de01729
Verified
Commit
3de01729
authored
Nov 21, 2017
by
Thibaut Broggi
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add unit tests using nodeunit
It currently only test the i18n functions
parent
f8933c26
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
50 additions
and
1 deletion
+50
-1
README.md
README.md
+6
-0
package.json
package.json
+1
-1
tests/run.js
tests/run.js
+43
-0
No files found.
README.md
View file @
3de01729
...
...
@@ -18,6 +18,12 @@ cp config.json.default config.json
npm
install
```
Testing require further dependencies:
```
sh
npm
install
-g
nodeunit
```
## Run
We're suggesting the use of pm2 to manage the service
...
...
package.json
View file @
3de01729
...
...
@@ -3,7 +3,7 @@
"version"
:
"1.0.0"
,
"description"
:
"Ce projet est le générateur de slogan et d'image utilisé par LQDN pour la campagne de dons 2017-2018."
,
"scripts"
:
{
"test"
:
"
echo
\"
Error: no test specified
\"
&& exit 1
"
,
"test"
:
"
nodeunit ./tests/run.js
"
,
"start"
:
"./srv.js"
},
"repository"
:
{
...
...
tests/run.js
0 → 100755
View file @
3de01729
#!/usr/bin/env nodeunit
const
I18n
=
require
(
'
../i18n.js
'
);
const
i18n
=
new
I18n
();
exports
.
i18n
=
{
defaultLocale
:
function
(
test
)
{
test
.
strictEqual
(
i18n
.
getLocale
(),
'
en
'
);
test
.
done
();
},
changeLocale
:
function
(
test
)
{
i18n
.
setLocale
(
'
fr
'
);
test
.
strictEqual
(
i18n
.
getLocale
(),
'
fr
'
);
test
.
done
();
},
testTranslation
:
{
enLocale
:
function
(
test
)
{
i18n
.
setLocale
(
'
en
'
);
test
.
strictEqual
(
i18n
.
_
(
'
Français
'
),
'
French
'
);
test
.
done
();
},
frLocale
:
function
(
test
)
{
i18n
.
setLocale
(
'
fr
'
);
test
.
strictEqual
(
i18n
.
_
(
'
Français
'
),
'
Français
'
);
test
.
done
();
},
noLocale
:
function
(
test
)
{
i18n
.
setLocale
(
undefined
);
test
.
strictEqual
(
i18n
.
_
(
'
Français
'
),
'
Français
'
);
test
.
done
();
},
otherLocale
:
function
(
test
)
{
i18n
.
setLocale
(
'
ru
'
);
test
.
strictEqual
(
i18n
.
_
(
'
Français
'
),
'
Français
'
);
test
.
done
();
}
}
};
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