d7def242b8
* Starting on namespaced id * Traversal for variables uniqued by namespace * Delog * Basic CRUD complete w namespaces included * Correct secvar breadcrumb joining and testfix now that namespaces are included * Testfixes with namespaces in place * Namespace-aware duplicate path warning * Duplicate path warning test additions * Trimpath reimplemented on dupe check * Solves a bug where slash was not being passed to the can write check * PR fixes * variable paths integration test fix now uses store * Seems far less hacky in retrospect * PR feedback addressed * test fixes after inclusion of path as local non-model var * Prevent confusion by dropping namespace from QPs on PUT, since its already in .data * Solves a harsh bug where you have namespace access but no secvars access (#14098) * Solves a harsh bug where you have namespace access but no secvars access * Lint cleanup * Remove unneeded condition
29 lines
943 B
JavaScript
29 lines
943 B
JavaScript
import { module, test } from 'qunit';
|
|
import { setupTest } from 'ember-qunit';
|
|
|
|
module('Unit | Adapter | Variable', function (hooks) {
|
|
setupTest(hooks);
|
|
|
|
test('Correctly pluralizes lookups with shortened path', async function (assert) {
|
|
this.store = this.owner.lookup('service:store');
|
|
this.subject = () => this.store.adapterFor('variable');
|
|
|
|
let newVariable = await this.store.createRecord('variable');
|
|
// we're incorrectly passing an object with a `Model` interface
|
|
// we should be passing a `Snapshot`
|
|
// hacky fix to rectify the issue
|
|
newVariable.attr = () => {};
|
|
|
|
assert.equal(
|
|
this.subject().urlForFindAll('variable'),
|
|
'/v1/vars',
|
|
'pluralizes findAll lookup'
|
|
);
|
|
assert.equal(
|
|
this.subject().urlForFindRecord('foo/bar', 'variable', newVariable),
|
|
`/v1/var/${encodeURIComponent('foo/bar')}?namespace=default`,
|
|
'singularizes findRecord lookup'
|
|
);
|
|
});
|
|
});
|