2.0.0 • Published 5 years ago

island-endpoint-tester v2.0.0

Weekly downloads
-
License
MIT
Repository
-
Last release
5 years ago

island-endpoint-tester

import * as island from 'island';
import * as _ from 'lodash';
 
// NOTE: *order important* Test must be installed before endpoint-controllers
import { Tester } from 'island-endpoint-tester';
Tester.install(island);
 
import { EndpointController } from '../controller/endpoint.controller';
import spec = island.spec;
import mongoose = island.mongoose;
 
describe(EndpointController.name, () => {
  beforeAll(spec(async() => {
    Tester.register(EndpointController);
  }));
 
  it('GET /v2/admin/accounts', spec(async() => {
    const id = new mongoose.Types.ObjectId().toHexString();
    const offset = 1;
    const limit = 30;
    const result = [{
      id: id, 
      activate: true,
    }];
 
    const testResult = Tester.GET(`/v2/admin/accounts?id=${id}&offset=${offset}&limit=${limit}`, {result});
    expect(testResult.query.id).toEqual(id);
    expect(testResult.query.offset).toEqual(offset);
    expect(testResult.query.limit).toEqual(limit);
  }));
});
2.1.0-rc.2

6 years ago

2.1.0-rc.1

6 years ago

2.0.0

6 years ago

1.0.2

6 years ago

1.0.1

7 years ago

1.0.0

7 years ago

0.1.0

7 years ago

0.0.5

7 years ago

0.0.4

7 years ago

0.0.3

7 years ago

0.0.2

7 years ago

0.0.1

7 years ago