Skip to content

Commit 1ef3393

Browse files
committed
Update and test the readme
1 parent 8d6f59f commit 1ef3393

File tree

2 files changed

+74
-11
lines changed

2 files changed

+74
-11
lines changed

README.md

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,24 @@ Used to run tests in node, without the need to run Enonic XP.
88

99
```ts
1010
import {deepStrictEqual} from 'assert';
11-
import {JavaBridge} from '@enonic/mock-xp';
11+
import {
12+
LibNode,
13+
Server
14+
} from '@enonic/mock-xp';
1215

1316

1417
const APP_NAME = 'com.enonic.app.example';
1518

19+
const server = new Server().createRepo({id: APP_NAME});
1620

17-
const xp = new JavaBridge({
18-
app: {
19-
config: {},
20-
name: APP_NAME,
21-
version: '0.0.1-SNAPSHOT'
22-
}
23-
});
24-
xp.repo.create({
25-
id: APP_NAME
21+
const libNode = new LibNode({
22+
server
2623
});
2724

2825

2926
describe('whatever', () => {
3027
it(`is correct`, () => {
31-
const connection = xp.connect({
28+
const connection = libNode.connect({
3229
repoId: APP_NAME,
3330
branch: 'master'
3431
});
@@ -39,6 +36,19 @@ describe('whatever', () => {
3936
deepStrictEqual(
4037
{
4138
_id: createdNode._id,
39+
_indexConfig: {
40+
configs: [],
41+
default: {
42+
decideByType: true,
43+
enabled: true,
44+
fulltext: false,
45+
includeInAllText: false,
46+
indexValueProcessors: [],
47+
languages: [],
48+
nGram: false,
49+
path: false,
50+
},
51+
},
4252
_name: FOLDER_NAME,
4353
_path: createdNode._path,
4454
_nodeType: 'default',

test/README.md.test.ts

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
import {deepStrictEqual} from 'assert';
2+
import {
3+
LibNode,
4+
Server
5+
} from '../src';
6+
7+
8+
const APP_NAME = 'com.enonic.app.example';
9+
10+
const server = new Server().createRepo({id: APP_NAME});
11+
12+
const libNode = new LibNode({
13+
server
14+
});
15+
16+
17+
describe('whatever', () => {
18+
it(`is correct`, () => {
19+
const connection = libNode.connect({
20+
repoId: APP_NAME,
21+
branch: 'master'
22+
});
23+
const FOLDER_NAME = 'folderName';
24+
const createdNode = connection.create({
25+
_name: FOLDER_NAME
26+
});
27+
deepStrictEqual(
28+
{
29+
_id: createdNode._id,
30+
_indexConfig: {
31+
configs: [],
32+
default: {
33+
decideByType: true,
34+
enabled: true,
35+
fulltext: false,
36+
includeInAllText: false,
37+
indexValueProcessors: [],
38+
languages: [],
39+
nGram: false,
40+
path: false,
41+
},
42+
},
43+
_name: FOLDER_NAME,
44+
_path: createdNode._path,
45+
_nodeType: 'default',
46+
_state: 'DEFAULT',
47+
_ts: createdNode._ts,
48+
_versionKey: createdNode._versionKey,
49+
},
50+
createdNode
51+
);
52+
});
53+
});

0 commit comments

Comments
 (0)