Skip to content

Commit

Permalink
test: remove test cases for removed list form fn
Browse files Browse the repository at this point in the history
  • Loading branch information
karrui committed Nov 3, 2020
1 parent bbc3f8a commit 346a988
Showing 1 changed file with 0 additions and 59 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -292,65 +292,6 @@ describe('Admin-Forms Controller', () => {
})
})

describe('list', () => {
it('should fetch forms with corresponding admin or collaborators and sorted by last modified', async (done) => {
const currentAdmin = testUser
// Insert additional user into User collection.
const collabAdmin = await User.create({
email: '[email protected]',
_id: mongoose.Types.ObjectId('000000000002'),
agency: testAgency._id,
})
// Is admin
let form1 = new Form({
title: 'Test Form1',
emails: currentAdmin.email,
admin: currentAdmin._id,
}).save()
// Is collab
let form2 = new Form({
title: 'Test Form2',
emails: collabAdmin.email,
admin: collabAdmin._id,
permissionList: [roles.collaborator(currentAdmin.email)],
}).save()
// Should not be fetched since archived
let form3 = new Form({
title: 'Test Form3',
emails: currentAdmin.email,
admin: currentAdmin._id,
status: 'ARCHIVED',
}).save()
// This form should not be fetched (not collab or admin)
let form4 = new Form({
title: 'Test Form3',
emails: currentAdmin.email,
admin: collabAdmin._id,
permissionList: [roles.collaborator('[email protected]')],
}).save()

Promise.all([form1, form2, form3, form4])
.then(() => {
res.json.and.callFake((args) => {
let times = args.map((f) => f.lastModified)
// Should be sorted by last modified in descending order
expect(times).toEqual(
times.sort((a, b) => {
return b - a
}),
)
// 3 forms to be fetched
expect(args.length).toEqual(3)
done()
})
Controller.list(req, res)
})
.catch((err) => {
done(err)
})
})
})

describe('getFeedback', () => {
it('should retrieve correct response based on saved FormFeedbacks', (done) => {
// Define feedback to be added to MongoMemoryServer db
Expand Down

0 comments on commit 346a988

Please sign in to comment.