Skip to content
This repository was archived by the owner on Oct 10, 2025. It is now read-only.
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 25 additions & 0 deletions test/rest/rest.acceptance.em
Original file line number Diff line number Diff line change
Expand Up @@ -274,3 +274,28 @@ describe "rest", ->
expect(foo.baz).to.not.be.null
expect(bar.foos.length).to.eq 1
expect(baz.foos.length).to.eq 1

describe 'custom deserialization', ->
beforeEach ->
class @User extends Ep.Model
name: Ep.attr('string')
city: Ep.attr('string')
@App.User = @User

@container.register 'model:user', @User, instantiate: false

UserSerializer = Ep.RestSerializer.extend
properties:
city:
key: "location"

@container.register 'serializer:user', UserSerializer

it 'uses custom property key', ->
adapter.r['GET:/users/1'] = -> user: {id: "1", name: "John",
location: "Los Angeles"}

session.load("user", 1).then (user) ->
expect(user.id).to.eq("1")
expect(user.name).to.eq("John")
expect(user.city).to.eq("Los Angeles")