Skip to content

Commit

Permalink
test: use objectId instead of string when building mongoose schemas
Browse files Browse the repository at this point in the history
  • Loading branch information
karrui committed Aug 7, 2020
1 parent df099b4 commit 0f31d59
Showing 1 changed file with 9 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -592,7 +592,7 @@ describe('Verification Controller', () => {
.save({ validateBeforeSave: false })
.then(() => {
fixtures = {
form: testForm.toObject(),
form: testForm,
body: {
responses: [],
},
Expand All @@ -602,7 +602,7 @@ describe('Verification Controller', () => {
})
it('should allow submission if transaction does not exist for forms that do not contain any fields that have to be verified', (done) => {
// No transaction created for testForm
const field = testForm.toObject().form_fields[0]
const field = testForm.form_fields[0]
const response = {
_id: String(field._id),
fieldType: field.fieldType,
Expand Down Expand Up @@ -637,7 +637,7 @@ describe('Verification Controller', () => {
})
beforeEach(() => {
fixtures = {
form: testForm.toObject(),
form: testForm,
body: {
responses: [],
},
Expand All @@ -646,7 +646,7 @@ describe('Verification Controller', () => {

describe('No transaction', () => {
it('should prevent submission if transaction does not exist for a form containing fields that have to be verified', (done) => {
const field = testForm.toObject().form_fields[0]
const field = testForm.form_fields[0]
const response = {
_id: String(field._id),
fieldType: field.fieldType,
Expand All @@ -669,7 +669,7 @@ describe('Verification Controller', () => {
signedData: 'someData',
},
]).then(() => {
const field = testForm.toObject().form_fields[0]
const field = testForm.form_fields[0]
const response = {
_id: String(field._id),
fieldType: field.fieldType,
Expand All @@ -692,7 +692,7 @@ describe('Verification Controller', () => {
signedData: null,
},
]).then(() => {
const field = testForm.toObject().form_fields[0]
const field = testForm.form_fields[0]
const response = {
_id: String(field._id),
fieldType: field.fieldType,
Expand All @@ -716,8 +716,8 @@ describe('Verification Controller', () => {
'5e71ef8b19c1ed04b54cd5f9',
)

const field = testForm.toObject().form_fields[0]
const formId = testForm.toObject()._id
const field = testForm.form_fields[0]
const formId = testForm._id
let response = {
_id: String(field._id),
fieldType: field.fieldType,
Expand Down Expand Up @@ -814,7 +814,7 @@ describe('Verification Controller', () => {
fieldType: yesNoField.fieldType,
answer: fieldIsHidden ? 'No' : 'Yes',
}
fixtures.form = form.toObject()
fixtures.form = form
fixtures.body.responses.push(yesNoResponse)
fixtures.body.responses.push(response)
sendAndExpect(expectedStatus).end(done)
Expand Down

0 comments on commit 0f31d59

Please sign in to comment.