Skip to content

Commit

Permalink
Minor reshaping of spec
Browse files Browse the repository at this point in the history
  • Loading branch information
LFDM committed Mar 13, 2017
1 parent 0fac680 commit 5abe5b2
Showing 1 changed file with 16 additions and 13 deletions.
29 changes: 16 additions & 13 deletions src/denormalization/index.spec.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,19 +61,22 @@ const expectResolved = curry((k, val, obj) => {
return obj;
});

describe('with a fn, that returns one object', () => {
it('resolves references to simple id fields', (done) => {
const api = build(config(), [denormalizer()]);
api.message.getMessage(m1.id)
.then(expectResolved('author', users[m1.author]))
.then(expectResolved('recipient', users[m1.recipient]))
.then(() => done());
});
describe('denormalizer', () => {
describe('with a fn, that returns one object', () => {
it('resolves references to simple id fields', (done) => {
const api = build(config(), [denormalizer()]);
api.message.getMessage(m1.id)
.then(expectResolved('author', users[m1.author]))
.then(expectResolved('recipient', users[m1.recipient]))
.then(() => done());
});

it('resolves references to lists of ids', (done) => {
const api = build(config(), [denormalizer()]);
api.message.getMessage(m1.id)
.then(expectResolved('visibleTo', [users[m1.visibleTo[0]]]))
.then(() => done());
it('resolves references to lists of ids', (done) => {
const api = build(config(), [denormalizer()]);
api.message.getMessage(m1.id)
.then(expectResolved('visibleTo', [users[m1.visibleTo[0]]]))
.then(() => done());
});
});
});

0 comments on commit 5abe5b2

Please sign in to comment.