2023-03-01 09:39:41 -06:00
|
|
|
/**
|
|
|
|
|
* Copyright (c) HashiCorp, Inc.
|
|
|
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
|
|
|
*/
|
|
|
|
|
|
2021-07-08 11:38:41 -04:00
|
|
|
import { module, test } from 'qunit';
|
|
|
|
|
import { setupTest } from 'ember-qunit';
|
2023-02-01 13:46:23 -05:00
|
|
|
import { TYPE_CREDENTIAL_LIBRARY_VAULT_GENERIC } from 'api/models/credential-library';
|
2021-07-08 11:38:41 -04:00
|
|
|
|
|
|
|
|
module('Unit | Model | credential library', function (hooks) {
|
|
|
|
|
setupTest(hooks);
|
|
|
|
|
|
|
|
|
|
test('it exists', function (assert) {
|
|
|
|
|
let store = this.owner.lookup('service:store');
|
|
|
|
|
let model = store.createRecord('credential-library', {});
|
|
|
|
|
assert.ok(model);
|
|
|
|
|
});
|
2022-09-20 17:31:16 -07:00
|
|
|
|
|
|
|
|
test('it has isUnknown property and returns the expected values', async function (assert) {
|
|
|
|
|
assert.expect(2);
|
|
|
|
|
const store = this.owner.lookup('service:store');
|
2023-02-01 13:46:23 -05:00
|
|
|
const modelA = store.createRecord('credential-library', {
|
|
|
|
|
type: TYPE_CREDENTIAL_LIBRARY_VAULT_GENERIC,
|
|
|
|
|
});
|
2022-10-06 11:41:12 -04:00
|
|
|
const modelB = store.createRecord('credential-library', {
|
|
|
|
|
type: 'unknown',
|
|
|
|
|
});
|
2022-09-20 17:31:16 -07:00
|
|
|
|
|
|
|
|
assert.false(modelA.isUnknown);
|
|
|
|
|
assert.true(modelB.isUnknown);
|
|
|
|
|
});
|
2021-07-08 11:38:41 -04:00
|
|
|
});
|