Skip to content

Commit 2d33c4b

Browse files
cesineSeyZ
authored andcommitted
add test coverage for id as string
1 parent d02920e commit 2d33c4b

1 file changed

Lines changed: 19 additions & 1 deletion

File tree

test/serializer.js

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -57,6 +57,21 @@ describe('Options', function () {
5757
expect(json.data).to.not.have.keys('id');
5858
done(null, json);
5959
});
60+
61+
it('should be a string', function (done) {
62+
var dataSet = {
63+
id: 123,
64+
firstName: 'Sandro',
65+
lastName: 'Munda'
66+
};
67+
68+
var json = new JSONAPISerializer('user', {
69+
attributes: ['firstName', 'lastName'],
70+
}).serialize(dataSet);
71+
72+
expect(json.data.id).to.equal('123');
73+
done(null, json);
74+
});
6075
});
6176

6277
describe('pluralizeType', function () {
@@ -897,7 +912,7 @@ describe('JSON API Serializer', function () {
897912
firstName: 'Lawrence',
898913
lastName: 'Bennett',
899914
address: {
900-
id: '54735697e16624ba1eee36bf',
915+
id: 123,
901916
addressLine1: '361 Shady Lane',
902917
zipCode: '23185',
903918
country: 'USA'
@@ -934,6 +949,9 @@ describe('JSON API Serializer', function () {
934949
type: 'addresses'
935950
});
936951

952+
expect(json.included[1]).to.have.property('id')
953+
.equal('123');
954+
937955
done(null, json);
938956
});
939957
});

0 commit comments

Comments
 (0)