Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
5001CEM/unitTests/test-surveys.js
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
29 lines (26 sloc)
719 Bytes
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import test from 'ava' | |
import Surveys from '../modules/surveys.js' | |
test('GET SURVEY INFORMATION : invalid id', async test => { | |
test.plan(1) | |
const surveys = await new Surveys() | |
try { | |
await surveys.getSurveyInformation(1) | |
test.fail('error not thrown') | |
} catch(err) { | |
test.is(err.message, 'survey with ID "1" not found', 'incorrect error message') | |
} finally { | |
surveys.close() | |
} | |
}) | |
test('GET QUESTION : invalid id', async test => { | |
test.plan(1) | |
const surveys = await new Surveys() | |
try { | |
await surveys.getSurveyInformation(1, 2) | |
test.fail('error not thrown') | |
} catch(err) { | |
test.is(err.message, 'survey with ID "1" not found', 'incorrect error message') | |
} finally { | |
surveys.close() | |
} | |
}) |