Merge pull request #10886 from BerkeleyTrue/feat/test-object
Feat(challenges): Let tests be objects
This commit is contained in:
@ -35,10 +35,15 @@ export function getFileKey({ challengeType }) {
|
|||||||
|
|
||||||
export function createTests({ tests = [] }) {
|
export function createTests({ tests = [] }) {
|
||||||
return tests
|
return tests
|
||||||
.map(test => ({
|
.map(test => {
|
||||||
text: ('' + test).split('message: ').pop().replace(/\'\);/g, ''),
|
if (typeof tests === 'string') {
|
||||||
testString: test
|
return {
|
||||||
}));
|
text: ('' + test).split('message: ').pop().replace(/\'\);/g, ''),
|
||||||
|
testString: test
|
||||||
|
};
|
||||||
|
}
|
||||||
|
return test;
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
export function loggerToStr(args) {
|
export function loggerToStr(args) {
|
||||||
|
@ -24,7 +24,10 @@
|
|||||||
"<h1>Hello</h1>"
|
"<h1>Hello</h1>"
|
||||||
],
|
],
|
||||||
"tests": [
|
"tests": [
|
||||||
"assert.isTrue((/hello(\\s)+world/gi).test($('h1').text()), 'message: Your <code>h1</code> element should have the text \"Hello World\".');"
|
{
|
||||||
|
"text": "Your <code>h1</code> element should have the text \"Hello World\".');",
|
||||||
|
"testString": "assert.isTrue((/hello(\\s)+world/gi).test($('h1').text()), 'Your <code>h1</code> element should have the text \"Hello World\".');"
|
||||||
|
}
|
||||||
],
|
],
|
||||||
"type": "waypoint",
|
"type": "waypoint",
|
||||||
"challengeType": 0,
|
"challengeType": 0,
|
||||||
|
Reference in New Issue
Block a user