-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
97 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
let assert = require('assert'); | ||
let moment = require('moment') | ||
let { Tucson, Config } = require('../lib/index') | ||
|
||
describe('Check array', () => { | ||
const dummyUnderscoreJson = { | ||
id: 1, | ||
company_id: 1, | ||
title: 'Software engineer', | ||
description: 'Job desc', | ||
location: 'Anywhere', | ||
timezone: 'AZ', | ||
contact_email: 'admin@remozine.com', | ||
tags: [], | ||
published: true, | ||
company: [ | ||
{ | ||
company_name: 'remozine', | ||
company_url: 'www.remozine.com', | ||
company_logo_url: null | ||
}, | ||
{ | ||
company_name: 'google', | ||
company_url: 'google.com', | ||
company_logo_url: null | ||
} | ||
] | ||
} | ||
let formedResult = {} | ||
let cctucson = new Tucson(new Config('camelCase')) | ||
|
||
before(() => { | ||
cctucson.formed(dummyUnderscoreJson, {}, formedResult) | ||
}) | ||
|
||
describe('check array values', () => { | ||
it('data inside array value should be converted ', function() { | ||
assert(formedResult["company"] instanceof Array === true) | ||
assert(formedResult["company"][0]["companyName"] === "remozine") | ||
assert(formedResult["company"][1]["companyName"] === "google") | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
let assert = require('assert'); | ||
let moment = require('moment') | ||
let { Tucson, Config } = require('../lib/index') | ||
|
||
describe('Check date', () => { | ||
|
||
const dummyUnderscoreJson = { | ||
id: 1, | ||
company_id: 1, | ||
title: 'Software engineer', | ||
description: 'Job desc', | ||
location: 'Anywhere', | ||
timezone: 'AZ', | ||
contact_email: 'admin@remozine.com', | ||
created_at: new Date('2023-05-28 09:00:00'), | ||
updated_at: new Date('2023-05-28 09:00:00'), | ||
published: true | ||
} | ||
let formedResult = {} | ||
let cctucson = new Tucson(new Config('camelCase')) | ||
|
||
before(() => { | ||
cctucson.formed(dummyUnderscoreJson, {}, formedResult) | ||
}) | ||
|
||
describe('check date', () => { | ||
it('value with type `Date` should not be converted', function() { | ||
assert(formedResult['createdAt'].toLocaleString() === "5/28/2023, 9:00:00 AM") | ||
}); | ||
}); | ||
}); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters