# all files / files/ MockDataFile.js

100% Statements 72/72
100% Branches 36/36
100% Functions 13/13
100% Lines 7/7
17 statements, 16 branches Ignored

    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    22
    23
    24
    25

    2
    1

    2

    2

    1

    2

     'use strict';

    // Dependencies:
    import File from './File';

    export default class MockDataFile extends File {
        save (data) {
            if (data) {
                this.content = data;
            }
            return super.save();
        }

        delete () {
            return super.delete()
            .then(() => deleteFileReferences.call(this));
        }
    }

    function deleteFileReferences () {
        let { references } = this.directory.fileStructure;

        delete references[this.path];
    }