From 824c0399db2dcb360b0599375c5e613c99f051b3 Mon Sep 17 00:00:00 2001 From: jrea Date: Tue, 14 Jun 2022 11:23:01 -0400 Subject: [PATCH] fix: use initial workspace --- lib/nile/src/Nile.ts | 1 + lib/nile/src/test/index.test.ts | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/lib/nile/src/Nile.ts b/lib/nile/src/Nile.ts index eac309b4..00d72d5d 100644 --- a/lib/nile/src/Nile.ts +++ b/lib/nile/src/Nile.ts @@ -91,6 +91,7 @@ function ApiImpl(config?: ConfigurationParameters): NileApi { const cfg = new Configuration(config); const nile = new NileApi(cfg); + nile.workspace = cfg.workspace; return nile; } export default ApiImpl; diff --git a/lib/nile/src/test/index.test.ts b/lib/nile/src/test/index.test.ts index ca15dc7e..3d2e3967 100644 --- a/lib/nile/src/test/index.test.ts +++ b/lib/nile/src/test/index.test.ts @@ -74,6 +74,7 @@ describe('index', () => { 'listUsers', 'loginUser', 'me', + 'updateUser', 'validateUser', ]); } @@ -161,4 +162,13 @@ describe('index', () => { expect(nile.workspaces.workspace).toBeTruthy(); expect(nile.organizations.workspace).toBeTruthy(); }); + it('sets the initial workspace', () => { + const nile = Nile({ workspace: '123' }); + expect(nile.workspace).toBe('123'); + expect(nile.users.workspace).toBe('123'); + expect(nile.developers.workspace).toBe('123'); + expect(nile.entities.workspace).toBe('123'); + expect(nile.workspaces.workspace).toBe('123'); + expect(nile.organizations.workspace).toBe('123'); + }); });