Skip to content

Commit

Permalink
test: use dist/modules/types/moment/SchemaTypeMoment instead of `wa…
Browse files Browse the repository at this point in the history
…rehouse.SchemaTypeMoment`
  • Loading branch information
yoshinorin committed Feb 28, 2023
1 parent 4494db9 commit 978c462
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions test/scripts/models/moment.js
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
'use strict';

const moment = require('moment-timezone');
const SchemaTypeMoment = require('../../../dist/models/types/moment');

describe('SchemaTypeMoment', () => {
const SchemaTypeMoment = require('../../../dist/models/types/moment');
const type = new warehouse.SchemaTypeMoment('test');
const type = new SchemaTypeMoment('test');

it('cast()', () => {
type.cast(1e8).should.eql(moment(1e8));
Expand All @@ -14,14 +14,14 @@ describe('SchemaTypeMoment', () => {
});

it('cast() - default', () => {
const type = new warehouse.SchemaTypeMoment('test', {default: moment});
const type = new SchemaTypeMoment('test', {default: moment});
moment.isMoment(type.cast()).should.be.true;
});

it('cast() - language', () => {
const lang = 'zh-tw';
const format = 'LLLL';
const type = new warehouse.SchemaTypeMoment('test', {language: lang});
const type = new SchemaTypeMoment('test', {language: lang});
const now = Date.now();

type.cast(now).format(format).should.eql(moment(now).locale(lang).format(format));
Expand All @@ -30,7 +30,7 @@ describe('SchemaTypeMoment', () => {
it('cast() - timezone', () => {
const timezone = 'Etc/UTC';
const format = 'LLLL';
const type = new warehouse.SchemaTypeMoment('test', {timezone});
const type = new SchemaTypeMoment('test', {timezone});
const now = Date.now();

type.cast(now).format(format).should.eql(moment(now).tz(timezone).format(format));
Expand All @@ -49,7 +49,7 @@ describe('SchemaTypeMoment', () => {
});

it('validate() - required', () => {
const type = new warehouse.SchemaTypeMoment('test', {required: true});
const type = new SchemaTypeMoment('test', {required: true});

should.throw(() => type.validate(), '`test` is required!');
});
Expand Down

0 comments on commit 978c462

Please sign in to comment.