Skip to content
This repository has been archived by the owner on Oct 10, 2023. It is now read-only.

Commit

Permalink
1.1.2
Browse files Browse the repository at this point in the history
  • Loading branch information
saitho committed Jan 8, 2020
1 parent 4b1b484 commit 8f6c3ab
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 3 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "amp-css",
"version": "1.1.1",
"version": "1.1.2",
"description": "Provides a binary to compile SCSS files and validate them for AMP.",
"bin": {
"amp-css": "dist/bin/amp-css"
Expand Down
20 changes: 18 additions & 2 deletions test/Commands/ProcessCommand.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,12 @@ import * as mockfs from "mock-fs";
import {Cli} from "../../src/Cli";
import * as assert from "assert";

function setProperty(object, property, value) {
const originalProperty = Object.getOwnPropertyDescriptor(object, property);
Object.defineProperty(object, property, { value });
return originalProperty
}

describe("ProcessCommand", () => {
let cli: Cli = null;
let cliSpy: Cli = null;
Expand Down Expand Up @@ -72,12 +78,22 @@ describe("ProcessCommand", () => {
});

it("missing option src should fail", (done: DoneCallback) => {
const exitMock = jest.fn();
const originalProperty = setProperty(process, 'exit', exitMock);

when(cliSpy.getOptions()).thenReturn({
dest: 'scss/some-file.css',
});
command.run()
.then(() => done('Expected to fail.'))
.catch(() => done());
.then(() => {
setProperty(process, 'exit', originalProperty);
done('Expected to fail.');
})
.catch(() => {
expect(exitMock).toHaveBeenCalledWith(1);
setProperty(process, 'exit', originalProperty);
done();
});
});

it("missing option dest should succeed", (done: DoneCallback) => {
Expand Down

0 comments on commit 8f6c3ab

Please sign in to comment.