refactor: 💡 implement new pathing for users
This commit is contained in:
17 files changed
+154
-78
No files matched your search
@@ -97,17 +97,17 @@ module('Unit | Model | base', function (hooks) {
|
||||
assert.expect(3);
|
||||
const store = this.owner.lookup('service:store');
|
||||
const model = store.createRecord('user', { scopeID: 'o_123' });
|
||||
this.server.post('/v1/scopes/o_123/users', () => {
|
||||
this.server.post('/v1/users', () => {
|
||||
assert.ok(true, 'Correctly scoped create record URL was requested.')
|
||||
return {};
|
||||
});
|
||||
await model.save();
|
||||
this.server.patch('/v1/scopes/o_123/users', () => {
|
||||
this.server.patch('/v1/users', () => {
|
||||
assert.ok(true, 'Correctly scoped update record URL was requested.')
|
||||
return {};
|
||||
});
|
||||
await model.save();
|
||||
this.server.delete('/v1/scopes/o_123/users', () => {
|
||||
this.server.delete('/v1/users', () => {
|
||||
assert.ok(true, 'Correctly scoped delete record URL was requested.')
|
||||
return {};
|
||||
});
|
||||
@@ -120,17 +120,17 @@ module('Unit | Model | base', function (hooks) {
|
||||
const customScopeID = 'global';
|
||||
const scope = {scope_id: 'o_123'};
|
||||
const model = store.createRecord('user', { scope });
|
||||
this.server.post('/v1/scopes/global/users', () => {
|
||||
this.server.post('/v1/users', () => {
|
||||
assert.ok(true, 'Correctly scoped create record URL was requested.')
|
||||
return {};
|
||||
});
|
||||
await model.save({adapterOptions: {scopeID: customScopeID}});
|
||||
this.server.patch('/v1/scopes/global/users', () => {
|
||||
this.server.patch('/v1/users', () => {
|
||||
assert.ok(true, 'Correctly scoped update record URL was requested.')
|
||||
return {};
|
||||
});
|
||||
await model.save({adapterOptions: {scopeID: customScopeID}});
|
||||
this.server.delete('/v1/scopes/global/users', () => {
|
||||
this.server.delete('/v1/users', () => {
|
||||
assert.ok(true, 'Correctly scoped delete record URL was requested.')
|
||||
return {};
|
||||
});
|
||||
@@ -143,7 +143,7 @@ module('Unit | Model | base', function (hooks) {
|
||||
const method = 'my-custom-method';
|
||||
const scope = {scope_id: 'o_123'};
|
||||
const model = store.createRecord('user', { scope });
|
||||
this.server.post(`/v1/scopes/o_123/users:${method}`, () => {
|
||||
this.server.post(`/v1/users:${method}`, () => {
|
||||
assert.ok(true, 'Correctly scoped create record URL was requested.')
|
||||
return {};
|
||||
});
|
||||
|
||||
Reference in new issue
Block a user