Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
describe('isSelectedYear', () => {
it.each([
[dayjs(new Date([2018, 5, 16])), 2018, true],
[dayjs(new Date([2018, 5, 16])), 2019, false],
])(
'when currentDate equal %p, and year is %p, should return %p',
(date, year, expectedResult) => {
const wrapper = mountComponent({
date: new Dates(date.month(), date.year(), { lang: 'en' }),
});
expect(wrapper.vm.isSelectedYear(year)).toEqual(expectedResult);
}
);
});
_submit () {
let param = {
expireTime: dayjs(this.expireTime).format('YYYY-MM-DD HH:mm:ss'),
userId: this.userId,
token: this.token
}
if (this.item) {
param.id = this.item.id
}
this.$refs['popup'].spinnerLoading = true
this.store.dispatch(`user/${this.item ? 'updateToken' : 'createToken'}`, param).then(res => {
this.$emit('onUpdate')
this.$message.success(res.msg)
setTimeout(() => {
this.$refs['popup'].spinnerLoading = false
}, 800)
}).catch(e => {
this.$message.error(e.msg || '')
this.$refs['popup'].spinnerLoading = false
render() {
const { stopTime, t, tokenName, totalValue, withdrawable } = this.props;
const isWithdrawable = withdrawable !== 0;
return (
this.onClose()}>
<div>
<span>
{t("confirm")} {t("action")}
</span>
<div>
<span>
{t("stopAndWithdrawWarning", {
withdrawableLabel: `${withdrawable} ${tokenName}`,
leftoverIncomeLabel: `${totalValue - withdrawable} ${tokenName}`,
stopTimeLabel: formatTime(t, dayjs(stopTime), false),
})}
</span>
this.onClickStopAndWithdraw()}
label={`${t("stopAndWithdraw")} ${withdrawable} ${tokenName}`}
/>
</div>
);</div>
public getFormatDay() {
return dayjs().format('YYYY/MM/DD');
}
const Date = ({ date, ...rest }) =>
date ? (
{dayjs(date)
.format("MMM")
.toUpperCase()}
{dayjs(date).format("DD")}
) : null;
const getTitle = (item, stx) => {
hooks.map((hook, i) => {
const diffMinutes = dayjs(hook?.finishedAt).diff(dayjs(hook?.startedAt), "minutes");
return (
<div>
<div>
<div>
<p>{hook.name} <span>Pod: {hook.podName} </span> </p>
<span> {hook.command} </span>
</div>
</div>
<div>
<p><span>{hook.errors ? "Failed" : "Completed"}</span></p>
{!hook.errors &&
<p> Finished in {diffMinutes === 0 ? "less than a minute" : `${diffMinutes} minutes`} </p>}
{hook.stderr !== "" || hook.stdout !== "" &&
<span> this.toggleScriptsOutput(hook)}> View output </span>}
</div>
</div>
recalculateTimes() {
let max = this.state.options.times.timeScale * 60;
let min = this.state.options.times.timeScale;
let steps = max / min;
let percent = this.state.options.times.timeZoom / 100;
this.state.options.times.timePerPixel =
this.state.options.times.timeScale * steps * percent + Math.pow(2, this.state.options.times.timeZoom);
this.state.options.times.totalViewDurationMs = dayjs(this.state.options.times.lastTime).diff(
this.state.options.times.firstTime,
'milliseconds'
);
this.state.options.times.totalViewDurationPx =
this.state.options.times.totalViewDurationMs / this.state.options.times.timePerPixel;
this.state.options.width =
this.state.options.times.totalViewDurationPx + this.style['grid-line-vertical']['stroke-width'];
},
res = res.map(function (each) {
each.CreatedAt = dayjs(each.CreatedAt).format("DD/MM/YYYY HH:mm")
return each
})
resolve(res)