github.com/hernad/nomad@v1.6.112/ui/tests/utils/push-payload-to-store.js (about)

     1  /**
     2   * Copyright (c) HashiCorp, Inc.
     3   * SPDX-License-Identifier: MPL-2.0
     4   */
     5  
     6  import { run } from '@ember/runloop';
     7  
     8  // These are private store methods called by store "finder" methods.
     9  // Useful in unit tests when there is store interaction, since calling
    10  // adapter and serializer methods directly will never insert data into
    11  // the store.
    12  export default function pushPayloadToStore(store, payload, modelName) {
    13    run(() => {
    14      store._push(payload);
    15      store._didUpdateAll(modelName);
    16    });
    17  }