Skip to content

Commit f1f4abd

Browse files
committed
Rename package to ltsx as it's conflicted with another
1 parent 0eaeb13 commit f1f4abd

File tree

5 files changed

+55
-55
lines changed

5 files changed

+55
-55
lines changed

index.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
const langs = require('./const-lang.js');
2-
const lts = require('./lts.js');
2+
const ltsx = require('./ltsx.js');
33

44
module.exports = {
5-
lts: lts,
5+
ltsx: ltsx,
66
langs: langs
77
}

lts.js renamed to ltsx.js

File renamed without changes.

package.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
11
{
2-
"name": "lts",
2+
"name": "ltsx",
33
"version": "1.0.0",
44
"description": "Localization module (marked with WeChat's mini-program supported)",
55
"main": "index.js",
66
"scripts": {
77
"test": "jasmine-node tests",
88
"wechat-mp": "bash scripts/mplify.sh",
99
"doc": "jsdoc README.md const-lang.js lts.js index.js -d ./docs",
10-
"publish-doc": "ghp-import -m 'Deployed with ghp-import' -p ./docs"
10+
"publish-doc": "npm run doc && ghp-import -m 'Deployed with ghp-import' -p ./docs"
1111
},
1212
"repository": {
1313
"type": "git",

tests/lts-spec.js

Lines changed: 0 additions & 51 deletions
This file was deleted.

tests/ltsx-spec.js

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
var { ltsx, langs } = require('../index.js')
2+
3+
describe('get', function() {
4+
it('should get empty object at start', function() {
5+
expect(ltsx.get(langs.English, 'fake-page-key', 'fake-text-key')).toBeNull()
6+
})
7+
})
8+
9+
describe('add', function() {
10+
beforeEach(function() {
11+
ltsx.clear()
12+
})
13+
14+
it('should have a matching element after adding', function() {
15+
ltsx.add(langs.English, 'firstPage', 'firstKey', 'Hello')
16+
17+
expect(ltsx.get(langs.English, 'firstPage', 'firstKey')).toEqual('Hello');
18+
})
19+
20+
afterEach(function() {
21+
ltsx.clear()
22+
})
23+
})
24+
25+
describe('remove', function() {
26+
beforeEach(function() {
27+
ltsx.clear()
28+
})
29+
30+
it('should have empty element after removing', function() {
31+
ltsx.add(langs.English, 'firstPage', 'firstKey', 'Hello')
32+
expect(ltsx.get(langs.English, 'firstPage', 'firstKey')).toEqual('Hello')
33+
34+
ltsx.remove(langs.English, 'firstPage', 'firstKey')
35+
expect(ltsx.get(langs.English, 'firstPage', 'firstKey')).toEqual(undefined)
36+
})
37+
})
38+
39+
describe('clear', function() {
40+
beforeEach(function() {
41+
ltsx.clear()
42+
})
43+
44+
it('should clear definitions thus having empty elements at the end', function() {
45+
ltsx.add(langs.English, 'firstPage', 'firstKey', 'Hello')
46+
expect(ltsx.get(langs.English, 'firstPage', 'firstKey')).toEqual('Hello')
47+
48+
ltsx.clear()
49+
expect(ltsx.get(langs.English, 'firstPage', 'firstKey')).toBeNull()
50+
})
51+
})

0 commit comments

Comments
 (0)