From 7df0c840e07d17a2268a2ab18e6db7656b203b78 Mon Sep 17 00:00:00 2001 From: Douglas Christopher Wilson Date: Mon, 21 Feb 2022 19:07:26 -0500 Subject: [PATCH] tests: fix up app.locals tests --- test/app.locals.js | 54 +++++++++++++++++++++++++----------------------------- 1 file changed, 25 insertions(+), 29 deletions(-) rewrite test/app.locals.js (85%) diff --git a/test/app.locals.js b/test/app.locals.js dissimilarity index 85% index 88f83c94..657b4b75 100644 --- a/test/app.locals.js +++ b/test/app.locals.js @@ -1,29 +1,25 @@ -'use strict' - -var assert = require('assert') -var express = require('../') -var should = require('should') - -describe('app', function(){ - describe('.locals(obj)', function(){ - it('should merge locals', function(){ - var app = express(); - should(Object.keys(app.locals)).eql(['settings']) - app.locals.user = 'tobi'; - app.locals.age = 2; - should(Object.keys(app.locals)).eql(['settings', 'user', 'age']) - assert.strictEqual(app.locals.user, 'tobi') - assert.strictEqual(app.locals.age, 2) - }) - }) - - describe('.locals.settings', function(){ - it('should expose app settings', function(){ - var app = express(); - app.set('title', 'House of Manny'); - var obj = app.locals.settings; - should(obj).have.property('env', 'test') - should(obj).have.property('title', 'House of Manny') - }) - }) -}) +'use strict' + +var assert = require('assert') +var express = require('../') + +describe('app', function(){ + describe('.locals', function () { + it('should default object', function () { + var app = express() + assert.ok(app.locals) + assert.strictEqual(typeof app.locals, 'object') + }) + + describe('.settings', function () { + it('should contain app settings ', function () { + var app = express() + app.set('title', 'Express') + assert.ok(app.locals.settings) + assert.strictEqual(typeof app.locals.settings, 'object') + assert.strictEqual(app.locals.settings, app.settings) + assert.strictEqual(app.locals.settings.title, 'Express') + }) + }) + }) +}) -- 2.11.4.GIT