Skip to content

Commit

Permalink
Merge branch 'clean' of https://github.com/metalsmith/metadata into c…
Browse files Browse the repository at this point in the history
…lean
  • Loading branch information
wernerglinka committed Jul 23, 2023
2 parents 45b87e8 + fa5b39b commit 29a8cb3
Showing 1 changed file with 10 additions and 10 deletions.
20 changes: 10 additions & 10 deletions test/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,17 @@ const assert = require('assert')
const { it, describe } = require('mocha')
const Metalsmith = require('metalsmith')
const metadata = require('../lib')
const { name } = require('../package.json');
const { name } = require('../package.json')

describe('@metalsmith/metadata', function () {
it('should export a named plugin function matching package.json name', function () {
const namechars = name.split('/')[1];
const namechars = name.split('/')[1]
const camelCased = namechars.split('').reduce((str, char, i) => {
str += namechars[i - 1] === '-' ? char.toUpperCase() : char === '-' ? '' : char;
return str;
}, '');
str += namechars[i - 1] === '-' ? char.toUpperCase() : char === '-' ? '' : char
return str
}, '')
assert.deepStrictEqual(metadata().name, camelCased)
});
})

it('should parse JSON', function (done) {
const m = Metalsmith('test/fixtures/json').use(metadata({ file: 'src/data.json' }))
Expand All @@ -35,8 +35,8 @@ describe('@metalsmith/metadata', function () {
})

it('should parse TOML', function (done) {
// run this test locally after running "npm i toml"
it.skip()
// run this test locally after running "npm i toml" & removing this.skip
this.skip()
const m = Metalsmith('test/fixtures/toml').use(metadata({ file: 'src/data.toml' }))
m.build(function (err) {
if (err) return done(err)
Expand Down Expand Up @@ -179,8 +179,8 @@ describe('@metalsmith/metadata', function () {
})

it('should error when TOML is not installed', function (done) {
// run this test locally by removing it.skip & running "npm remove toml"
it.skip()
// run this test locally by removing this.skip & running "npm remove toml"
this.skip()
const Metalsmith = require('metalsmith')
Metalsmith('test/fixtures/toml')
.use(metadata({ file: 'src/data.toml' }))
Expand Down

0 comments on commit 29a8cb3

Please sign in to comment.