-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathAdapterFactory.spec.js
More file actions
38 lines (32 loc) · 862 Bytes
/
AdapterFactory.spec.js
File metadata and controls
38 lines (32 loc) · 862 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
import test from 'ava';
import CsvAdapter from '../src/Adapters/Csv.js';
import HttpAdapter from '../src/Adapters/Http.js';
import AdapterFactory from '../src/AdapterFactory.js';
import DatabaseAdapter from '../src/Adapters/Database.js';
test('It creates database adapter', async (t) => {
const adapter = AdapterFactory({
type: 'database',
options: {
client: 'sqlite',
},
});
t.true(adapter instanceof DatabaseAdapter);
});
test('It creates csv adapter', async (t) => {
const adapter = AdapterFactory({
type: 'csv',
options: {
path: 'my-fake-file',
},
});
t.true(adapter instanceof CsvAdapter);
});
test('It creates http adapter', async (t) => {
const adapter = AdapterFactory({
type: 'http',
options: {
url: 'http://api.com/users',
},
});
t.true(adapter instanceof HttpAdapter);
});