Skip to content

Commit

Permalink
fixed csv test breakage
Browse files Browse the repository at this point in the history
  • Loading branch information
andrewplummer committed Jun 25, 2024
1 parent 7ea97e7 commit 05d6030
Showing 1 changed file with 18 additions and 14 deletions.
32 changes: 18 additions & 14 deletions services/api/src/utils/__tests__/csv.js
Original file line number Diff line number Diff line change
Expand Up @@ -85,22 +85,26 @@ describe('csvExport', () => {
`);
});

it('should call toObject to prevent private field access', async () => {
const obj = {
user,
toObject: () => {
return {
user: {
firstName: 'Frank',
lastName: 'Reynolds',
},
};
it('should not export fields with no read access', async () => {
const User = createTestModel({
name: {
type: 'String',
},
};
const csv = await run([obj]);
secret: {
type: 'String',
readAccess: 'none',
},
});
const user = await User.create({
name: 'Frank',
secret: 'secret!!',
});
const created = user.createdAt.toISOString();
const updated = user.updatedAt.toISOString();
const csv = await run([user]);
expect(csv).toBe(d`
user.firstName,user.lastName
Frank,Reynolds
name,createdAt,updatedAt
Frank,${created},${updated}
`);
});

Expand Down

0 comments on commit 05d6030

Please sign in to comment.