Skip to content

Commit 13f6d0c

Browse files
committed
Update tests to use new schema
1 parent 482a39e commit 13f6d0c

1 file changed

Lines changed: 25 additions & 5 deletions

File tree

index.test.js

Lines changed: 25 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,14 @@
11
const commtrackr = require('./index.js');
22

3-
async function commTrackrHandler(data) {
3+
async function createHandler(data) {
4+
return data;
5+
};
6+
7+
async function updateHandler(req, data) {
8+
return data;
9+
};
10+
11+
async function syncHandler(req, data) {
412
return data;
513
};
614

@@ -55,12 +63,24 @@ describe('CommTrackr Backend Initialization', () => {
5563
required: true
5664
}
5765
]),
58-
handler: commTrackrHandler,
66+
handlers: {
67+
create: createHandler,
68+
update: updateHandler,
69+
sync: syncHandler
70+
}
5971
})).not.toThrow();
6072
});
61-
test('handler', async () => {
62-
expect(typeof commTrackrHandler).toBe('function');
63-
const result = await commTrackrHandler({ test: 'data' });
73+
test('handlers', async () => {
74+
expect(typeof createHandler).toBe('function');
75+
var result = await createHandler({ test: 'data' });
76+
expect(typeof result).toBe('object');
77+
expect(result).toHaveProperty('test', 'data');
78+
expect(typeof updateHandler).toBe('function');
79+
result = await updateHandler({}, { test: 'data' });
80+
expect(typeof result).toBe('object');
81+
expect(result).toHaveProperty('test', 'data');
82+
expect(typeof syncHandler).toBe('function');
83+
result = await syncHandler({}, { test: 'data' });
6484
expect(typeof result).toBe('object');
6585
expect(result).toHaveProperty('test', 'data');
6686
});

0 commit comments

Comments
 (0)