github.com/anth0d/nomad@v0.0.0-20221214183521-ae3a0a2cad06/ui/tests/unit/adapters/variable-test.js (about) 1 import { module, test } from 'qunit'; 2 import { setupTest } from 'ember-qunit'; 3 4 module('Unit | Adapter | Variable', function (hooks) { 5 setupTest(hooks); 6 7 test('Correctly pluralizes lookups with shortened path', async function (assert) { 8 this.store = this.owner.lookup('service:store'); 9 this.subject = () => this.store.adapterFor('variable'); 10 11 let newVariable = await this.store.createRecord('variable'); 12 // we're incorrectly passing an object with a `Model` interface 13 // we should be passing a `Snapshot` 14 // hacky fix to rectify the issue 15 newVariable.attr = () => {}; 16 17 assert.equal( 18 this.subject().urlForFindAll('variable'), 19 '/v1/vars', 20 'pluralizes findAll lookup' 21 ); 22 assert.equal( 23 this.subject().urlForFindRecord('foo/bar', 'variable', newVariable), 24 `/v1/var/${encodeURIComponent('foo/bar')}?namespace=default`, 25 'singularizes findRecord lookup' 26 ); 27 }); 28 });