@eyedea/syncano-test
Testing scripts for @eyedea/syncano
Last updated 4 months ago by idered .
MIT · Repository · Original npm · Tarball · package.json
$ cnpm install @eyedea/syncano-test 
SYNC missed versions from official npm registry.

@eyedea/syncano-test

Test solution for syncano socket based on @eyedea/syncano.

npm version license

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

  1. Create __tests__ directory in your socket. Add __tests__/tsconfig.json with the following content:
{
  "compilerOptions": {
    "lib": ["ES2015"]
  }
}
  1. 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

Current Tags

  • 0.2.0                                ...           latest (4 months ago)

28 Versions

  • 0.2.0                                ...           4 months ago
  • 0.1.1-alpha.25                                ...           4 months ago
  • 0.1.1-alpha.24                                ...           4 months ago
  • 0.1.1-alpha.23                                ...           4 months ago
  • 0.1.1-alpha.22                                ...           4 months ago
  • 0.1.1-alpha.21                                ...           4 months ago
  • 0.1.1-alpha.20                                ...           4 months ago
  • 0.1.1-alpha.19                                ...           4 months ago
  • 0.1.1-alpha.18                                ...           4 months ago
  • 0.1.1-alpha.17                                ...           4 months ago
  • 0.1.1-alpha.16                                ...           4 months ago
  • 0.1.1-alpha.15                                ...           4 months ago
  • 0.1.1-alpha.14                                ...           4 months ago
  • 0.1.1-alpha.13                                ...           4 months ago
  • 0.1.1-alpha.12                                ...           4 months ago
  • 0.1.1-alpha.11                                ...           4 months ago
  • 0.1.1-alpha.10                                ...           4 months ago
  • 0.1.1-alpha.9                                ...           4 months ago
  • 0.1.1-alpha.8                                ...           4 months ago
  • 0.1.1-alpha.7                                ...           4 months ago
  • 0.1.1-alpha.6                                ...           4 months ago
  • 0.1.1-alpha.5                                ...           4 months ago
  • 0.1.1-alpha.4                                ...           4 months ago
  • 0.1.1-alpha.3                                ...           4 months ago
  • 0.1.1-alpha.2                                ...           4 months ago
  • 0.1.1-alpha.1                                ...           4 months ago
  • 0.1.1-alpha.0                                ...           4 months ago
  • 0.1.0                                ...           4 months ago
Downloads
Today 0
This Week 0
This Month 28
Last Day 0
Last Week 28
Last Month 0
Dependencies (15)
Dev Dependencies (7)
Dependents (0)
None

Copyright 2014 - 2016 © taobao.org |