* feat: 🎸 create helper Create `time-remaining` helper to track remaining session time. ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-10519 * refactor: 💡 Clean up code for time-remaining helper Moved time remaining helper into `core` addons folder. Cleaned up the `time-remaining` helper to use the `DurationUnitFormat` service. ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-10519 * Update session.hbs removed test implementation * refactor: 💡 files added for helper files added for helper ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-10519 * Update session.hbs fix linting * refactor: 💡 fix uneeded spacing Fix spacing on hbs file used for testing time-remaining helper ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-10519 * refactor: 💡 refactor time-remaining helper Cleaned up code that was returning a string if `differenceInSeconds` was less than or equal to zero. Code is now conditionally checking in the `differenceInSeconds` variable if the `difference` is greater than zero. If it is not then it will return zero and let the `DurationUnitFormat` handle the rest. ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-10519 * refactor: 💡 fix failing test Fix failing `time-remaining` test ✅ Closes: https://hashicorp.atlassian.net/browse/ICU-10519
19 lines
414 B
JavaScript
19 lines
414 B
JavaScript
/**
|
|
* Copyright (c) HashiCorp, Inc.
|
|
* SPDX-License-Identifier: MPL-2.0
|
|
*/
|
|
|
|
import { Factory } from 'miragejs';
|
|
import { faker } from '@faker-js/faker';
|
|
|
|
/**
|
|
* GeneratedSessionModelFactory
|
|
*/
|
|
export default Factory.extend({
|
|
type: 'tcp',
|
|
created_time: () => faker.date.recent(),
|
|
updated_time: () => faker.date.recent(),
|
|
expiration_time: () => faker.date.soon(),
|
|
version: () => faker.number.int(),
|
|
});
|