mirror of
https://github.com/directus/directus.git
synced 2026-04-03 03:00:39 -04:00
* add new sdk * update version * fixes and sdk documentation * typing updates, documentation * added missing endpoints * targeting minified version for unpkg * removed unused types file * fixed non minified versions * fix sdk exports * fix the fix * Remove old sdk * Remove old sdk docs * Install types for Jest, add npm test * Rely on npm exclusively * Remove examples folder * Move typescript down * Update sdk.md * added auto refresh and requested changes added more http test calls fixed typing issue in customized types * remove unused endpoint * updated docs * added singletons, fixed typing issues, added password handlers * rename graphql function and fixed system endpoint * Remove unused imports, fix build Co-authored-by: rijkvanzanten <rijkvanzanten@me.com> Co-authored-by: Ben Haynes <ben@rngr.org>
37 lines
842 B
TypeScript
37 lines
842 B
TypeScript
/**
|
|
* @jest-environment node
|
|
*/
|
|
|
|
import { Directus } from '../../src';
|
|
import { test } from '../utils';
|
|
|
|
describe('invites', function () {
|
|
test('send', async (url, nock) => {
|
|
const scope = nock()
|
|
.post('/users/invite', {
|
|
email: 'admin@example.com',
|
|
role: '1e098175-6258-48d6-ad88-d24cae2abe15',
|
|
})
|
|
.reply(200, {});
|
|
|
|
const sdk = new Directus(url);
|
|
await sdk.users.invites.send('admin@example.com', '1e098175-6258-48d6-ad88-d24cae2abe15');
|
|
|
|
expect(scope.pendingMocks().length).toBe(0);
|
|
});
|
|
|
|
test(`accept`, async (url, nock) => {
|
|
const scope = nock()
|
|
.patch('/users/invite/accept', {
|
|
token: 'token',
|
|
password: 'password1234',
|
|
})
|
|
.reply(200, {});
|
|
|
|
const sdk = new Directus(url);
|
|
await sdk.users.invites.accept('token', 'password1234');
|
|
|
|
expect(scope.pendingMocks().length).toBe(0);
|
|
});
|
|
});
|