Skip to content

Commit 9abc586

Browse files
committed
Update testing infrastructure
1 parent 6372280 commit 9abc586

File tree

6 files changed

+24
-23
lines changed

6 files changed

+24
-23
lines changed

src/adapters/amqp.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { describe, it, expect, beforeAll } from 'vitest'
22
import * as bson from 'bson'
3-
import createApp from './app'
3+
import createApp from './fixture'
44
import { SyncApp } from '../types'
55

66
describe('feathers-sync AMQP tests', () => {

src/adapters/app.ts

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

src/adapters/fixture.ts

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
import { feathers, Application } from '@feathersjs/feathers'
2+
import sync, { AmqpSyncOptions, NatsSyncOptions, RedisSyncOptions, SyncOptions } from '../index'
3+
4+
class TodoService {
5+
events = ['custom']
6+
7+
async create(data: any) {
8+
return data
9+
}
10+
11+
async update(id: any, data: any, params: any) {
12+
return data
13+
}
14+
}
15+
16+
export default (options: RedisSyncOptions | AmqpSyncOptions | NatsSyncOptions) => {
17+
return (): Application => feathers().configure(sync(options)).use('/todo', new TodoService())
18+
}

src/adapters/nats.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
import { describe, it, expect, beforeAll } from 'vitest'
2-
import createApp from './app'
2+
import createApp from './fixture'
33
import { SyncApp } from '../types'
44

55
describe('feathers-sync NATS tests', () => {

src/adapters/redis.test.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
import { describe, it, expect, beforeAll } from 'vitest'
22
import * as bson from 'bson'
3-
import createApp from './app'
3+
import createApp from './fixture'
44
import { SyncApp } from '../types'
55

66
describe('feathers-sync Redis tests', () => {

src/index.test.ts

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
import { feathers } from '@feathersjs/feathers'
22
import { describe, it, expect } from 'vitest'
3-
import sync, { SYNC } from './index'
3+
import sync, { SYNC, redis, amqp } from './index'
44

55
describe('feathers-sync tests', () => {
66
it('exports db adapters', () => {
77
expect(typeof sync).toBe('function')
8-
expect(sync.redis).toBeTruthy()
9-
expect(sync.amqp).toBeTruthy()
8+
expect(redis).toBeTruthy()
9+
expect(amqp).toBeTruthy()
1010
})
1111

1212
it('throws an error when uri is missing', () => {

0 commit comments

Comments
 (0)