/*
 * Copyright (c) Facebook, Inc. and its affiliates.
 *
 * This source code is licensed under the MIT license found in the
 * LICENSE file in the root directory of this source tree.
 */

use fixture_tests::Fixture;
use graphql_test_helpers::apply_transform_for_test;
use graphql_transforms::sort_selections;

pub fn transform_fixture(fixture: &Fixture<'_>) -> Result<String, String> {
    apply_transform_for_test(fixture, |program| {
        let next_program = sort_selections(&program);
        assert_eq!(
            next_program.fragments().count(),
            program.fragments().count()
        );
        Ok(next_program)
    })
}
