0.2.0 • Published 4 years ago
@eyedea/syncano-test v0.2.0
@eyedea/syncano-test
Test solution for syncano socket based on @eyedea/syncano.
Install
Install package in your socket directory:
$ npm install -D @eyedea/syncano-test
It is recommended to install this package as dev dependency, otherwise a lot of unnecessary packages will be deployed with socket.
Usage
- Create
__tests__
directory in your socket. Add__tests__/tsconfig.json
with the following content:
{
"compilerOptions": {
"lib": ["ES2015"]
}
}
- Create your test file
__tests__/ENDPOINT-NAME.test.js
import {run, stub, createSyncanoCoreMock} from '@eyedea/syncano'
describe('SOCKET/ENDPOINT-NAME', () => {
it('should not fail', async () => {
const meta = {user: undefined}
const args = {id: 1}
const mocks = createSyncanoCoreMock({
data: {
entity: {
create: stub().resolves(args)
fields: stub().fn({
with: stub().fn({
findOrFail: stub().resolves(args)
})
})
}
}
})
const result = await run('ENDPOINT-NAME', {args, meta}, {mocks})
expect(result).toHaveProperty('data.id', args.id)
expect(result).toHaveProperty('code', 200)
})
})
License
MIT © Eyedea AS
0.1.1-alpha.19
4 years ago
0.1.1-alpha.18
4 years ago
0.1.1-alpha.17
4 years ago
0.1.1-alpha.16
4 years ago
0.1.1-alpha.15
4 years ago
0.1.1-alpha.14
4 years ago
0.1.1-alpha.13
4 years ago
0.1.1-alpha.22
4 years ago
0.1.1-alpha.21
4 years ago
0.1.1-alpha.20
4 years ago
0.2.0
4 years ago
0.1.1-alpha.25
4 years ago
0.1.1-alpha.24
4 years ago
0.1.1-alpha.23
4 years ago
0.1.1-alpha.12
4 years ago
0.1.1-alpha.11
4 years ago
0.1.1-alpha.10
4 years ago
0.1.1-alpha.9
4 years ago
0.1.1-alpha.8
4 years ago
0.1.1-alpha.7
4 years ago
0.1.1-alpha.6
4 years ago
0.1.1-alpha.4
4 years ago
0.1.1-alpha.5
4 years ago
0.1.1-alpha.3
4 years ago
0.1.1-alpha.2
4 years ago
0.1.1-alpha.1
4 years ago
0.1.1-alpha.0
4 years ago
0.1.0
4 years ago