From 3db2e6a950424b8b80268bd7bb6fe0d17448651f Mon Sep 17 00:00:00 2001 From: freearhey <7253922+freearhey@users.noreply.github.com> Date: Wed, 1 Jan 2025 10:48:16 +0300 Subject: [PATCH] Update update.test.ts --- tests/commands/sites/update.test.ts | 78 ++++++++++++++--------------- 1 file changed, 39 insertions(+), 39 deletions(-) diff --git a/tests/commands/sites/update.test.ts b/tests/commands/sites/update.test.ts index 40e18b77..2ecbea5e 100644 --- a/tests/commands/sites/update.test.ts +++ b/tests/commands/sites/update.test.ts @@ -1,39 +1,39 @@ -import { execSync } from 'child_process' -import fs from 'fs-extra' -import path from 'path' - -beforeEach(() => { - fs.emptyDirSync('tests/__data__/output') - fs.mkdirSync('tests/__data__/output/.sites') - fs.copyFileSync( - 'tests/__data__/input/.sites/config.json', - 'tests/__data__/output/.sites/config.json' - ) - fs.copyFileSync( - 'tests/__data__/input/.sites/template.md', - 'tests/__data__/output/.sites/template.md' - ) -}) - -it('can update SITES.md', () => { - execSync( - 'DOT_SITES_DIR=tests/__data__/output/.sites SITES_DIR=tests/__data__/input/sites-update/sites npm run sites:update', - { - encoding: 'utf8' - } - ) - - expect(content('tests/__data__/output/sites.md')).toEqual( - content('tests/__data__/expected/_sites.md') - ) - - expect(true).toBe(true) -}) - -function content(filepath: string) { - const data = fs.readFileSync(path.resolve(filepath), { - encoding: 'utf8' - }) - - return JSON.stringify(data) -} +import { execSync } from 'child_process' +import fs from 'fs-extra' +import path from 'path' + +beforeEach(() => { + fs.emptyDirSync('tests/__data__/output') + fs.mkdirSync('tests/__data__/output/.sites') + fs.copyFileSync( + 'tests/__data__/input/.sites/config.json', + 'tests/__data__/output/.sites/config.json' + ) + fs.copyFileSync( + 'tests/__data__/input/.sites/template.md', + 'tests/__data__/output/.sites/template.md' + ) +}) + +it('can update SITES.md', () => { + execSync( + 'DOT_SITES_DIR=tests/__data__/output/.sites SITES_DIR=tests/__data__/input/sites-update/sites npm run sites:update', + { + encoding: 'utf8' + } + ) + + expect(content('tests/__data__/output/sites.md')).toEqual( + content('tests/__data__/expected/_sites.md') + ) + + expect(true).toBe(true) +}) + +function content(filepath: string) { + const data = fs.readFileSync(path.resolve(filepath), { + encoding: 'utf8' + }) + + return JSON.stringify(data) +}