Created
March 30, 2023 20:55
-
-
Save BoDonkey/8dbd7b27f393ceb34877ed41e91d1248 to your computer and use it in GitHub Desktop.
test to check if the schema field is forbidden
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
const t = require('../test-lib/test.js'); | |
const assert = require('assert'); | |
let apos; | |
const apiKey = 'this is a test api key'; | |
describe('Pieces malformed', function () { | |
this.timeout(t.timeout); | |
after(async function () { | |
return t.destroy(apos); | |
}); | |
it('should not initialize with a forbidden field schema name', async function () { | |
const actual = async () => { | |
apos = await t.create({ | |
root: module, | |
modules: { | |
'@apostrophecms/express': { | |
options: { | |
apiKeys: { | |
[apiKey]: { | |
role: 'admin' | |
} | |
} | |
} | |
}, | |
malformed: { | |
extend: '@apostrophecms/piece-type', | |
fields: { | |
add: { | |
type: { | |
label: 'Type', | |
type: 'string' | |
} | |
} | |
} | |
} | |
} | |
}); | |
assert(false); | |
}; | |
const expected = new Error('@apostrophecms/piece-type field property name cannot be "type"'); | |
await assert.rejects(actual, expected); | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment