it('output .json format log', async () => { mm(process.env, 'EGG_LOG', 'none'); mm.env('local'); app = utils.app('apps/logger-output-json'); await app.ready(); const ctx = app.mockContext(); const logfile = path.join(app.config.logger.dir, 'logger-output-json-web.json.log'); ctx.logger.info('json format'); await sleep(2000); assert(fs.existsSync(logfile)); assert(fs.readFileSync(logfile, 'utf8').includes('"message":"json format"')); });
Object.keys(formErrors) .filter(key => key.includes('headers')) .reduce((obj, key) => { obj[key] = formErrors[key]; return obj; }, {})
const validateKeys = object => { if (typeof object == 'object') { for (const key in object) { if (typeof object[key] == 'object') { validateKeys(object[key]); } if (key.includes('$') || key.includes('.')) { throw new _node.default.Error(_node.default.Error.INVALID_NESTED_KEY, "Nested keys should not contain the '$' or '.' characters"); } } } }
const isInternalImport = node => { let source = ''; if (node.type === 'Variable') { source = node.node.init.arguments[0].value; } else if (node.type === 'ImportBinding') { source = node.parent.source.value; } return ( !source.includes('node_modules') && (source.startsWith('.') || source.startsWith('/')) ); }
const getCrossOrigin = (url = '', host = '') => { if (url.includes(`://${host}`)) { return ''; } return 'crossorigin'; }
createTypeName (value = '') { const { typeName } = this.source.options let res = value // this converts 'file--file' to just 'file' if (res.includes('--')) { const _split = res.split('--') if (_split[0] === _split[1]) res = _split[0] } return camelCase(`${typeName} ${res}`, { pascalCase: true }) }
it('should display the default page', async () => { await request(server) .get('/') .expect(200) .expect((response) => { assert.ok(response.text.includes('Tabs VS Spaces')); }); });
it('Nested entity references convert correctly back to LU', async () => { let luisApp = luisBuilder.fromJson(bf627); let luisAppInLu = luisApp.parseToLuContent() assert.isTrue(luisAppInLu.includes(`- when I use the {@outer=same {@inner=text} twice in nested ML entity text}`)) })
it ('phrase list names with spaces in them convert correctly to lu format', function(done){ let luContent = luconvert(entityNameWithSpaceAndFeature); assert.equal(luContent.includes(`@ phraselist "phone pl"(interchangeable)`), true); done() })
it ('composite entity names with spaces in them convert correctly to lu format', function(done){ let luContent = luconvert(entityNameWithSpaceAndFeature); assert.equal(luContent.includes(`@ composite "test composite"`), true); done() })
createTypeName (value = '') { const { typeName } = this.source.options let res = value // this converts 'file--file' to just 'file' if (res.includes('--')) { const _split = res.split('--') if (_split[0] === _split[1]) res = _split[0] } return camelCase(`${typeName} ${res}`, { pascalCase: true }) }
it ('ml entity names with spaces are converted correctly to lu', function(done) { let luContent = luconvert(entityNameWithSpaceAndFeature); assert.equal(luContent.includes(`@ ml "phone number entity"`), true); done() })