Skip to content

Commit

Permalink
test(fs): test for write to backup to call correct method (#3819)
Browse files Browse the repository at this point in the history
The previous test implementation was a copy of the sandbox tetst. This points the test to the correct method.
  • Loading branch information
florisg-infosupport authored Oct 29, 2022
1 parent 92c0852 commit 26be04c
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions packages/core/test/unit/fs/project-file.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -241,18 +241,18 @@ describe(ProjectFile.name, () => {
});

describe(ProjectFile.prototype.backupTo.name, () => {
it('should write to the sandbox', async () => {
it('should write to the backup', async () => {
// Arrange
const sut = createSut({ name: path.resolve('src', 'foo.js') });
fileSystemMock.readFile.resolves('original');
await sut.readOriginal();

// Act
const actualBackupFile = await sut.writeToSandbox(path.resolve('.stryker-tmp', 'backup123'));
const actualBackupFile = await sut.backupTo(path.resolve('.stryker-tmp', 'backup123'));

// Assert
expect(actualBackupFile).eq(path.resolve('.stryker-tmp', 'backup123', 'src', 'foo.js'));
sinon.assert.calledOnceWithExactly(fileSystemMock.writeFile, actualBackupFile, 'original', 'utf-8');
sinon.assert.calledOnceWithExactly(fileSystemMock.writeFile, actualBackupFile, 'original');
sinon.assert.notCalled(fileSystemMock.copyFile);
});

Expand All @@ -263,7 +263,7 @@ describe(ProjectFile.name, () => {
await sut.readOriginal();

// Act
const actualBackupFile = await sut.writeToSandbox(path.resolve('.stryker-tmp', 'backup123'));
const actualBackupFile = await sut.backupTo(path.resolve('.stryker-tmp', 'backup123'));

// Assert
sinon.assert.calledOnceWithExactly(fileSystemMock.mkdir, path.dirname(actualBackupFile), { recursive: true });
Expand Down

0 comments on commit 26be04c

Please # to comment.