<commit_before>/*global QUnit*/

sap.ui.require([
		"sap/ui/demo/wt/model/formatter",
		"sap/ui/model/resource/ResourceModel",
		"sap/ui/thirdparty/sinon",
		"sap/ui/thirdparty/sinon-qunit"
	],
	function (formatter, ResourceModel) {
		"use strict";

		QUnit.module("Formatting functions", {
			beforeEach: function () {
				this._oResourceModel = new ResourceModel({
					bundleUrl: jQuery.sap.getModulePath("sap.ui.demo.wt", "/i18n/i18n.properties")
				});
			},
			afterEach: function () {
				this._oResourceModel.destroy();
			}
		});


		QUnit.test("Should return the translated texts", function (assert) {

			// Arrange
			var oViewStub = {
				getModel: this.stub().withArgs("i18n").returns(this._oResourceModel)
			};
			var oControllerStub = {
				getView: this.stub().returns(oViewStub)
			};

			// System under test
			var fnIsolatedFormatter = formatter.statusText.bind(oControllerStub);

			// Assert
			assert.strictEqual(fnIsolatedFormatter("A"), "New", "The long text for status A is correct");

			assert.strictEqual(fnIsolatedFormatter("B"), "In Progress", "The long text for status B is correct");

			assert.strictEqual(fnIsolatedFormatter("C"), "Done", "The long text for status C is correct");

			assert.strictEqual(fnIsolatedFormatter("Foo"), "Foo", "The long text for status Foo is correct");
		});

	}
);<commit_msg>[INTERNAL][FIX] sap.m.demo.tutorial.walkthrough28 - getModel() method returns a value even with wrong parameter<commit_after>/*global QUnit*/

sap.ui.require([
		"sap/ui/demo/wt/model/formatter",
		"sap/ui/model/resource/ResourceModel",
		"sap/ui/thirdparty/sinon",
		"sap/ui/thirdparty/sinon-qunit"
	],
	function (formatter, ResourceModel) {
		"use strict";

		QUnit.module("Formatting functions", {
			beforeEach: function () {
				this._oResourceModel = new ResourceModel({
					bundleUrl: jQuery.sap.getModulePath("sap.ui.demo.wt", "/i18n/i18n.properties")
				});
			},
			afterEach: function () {
				this._oResourceModel.destroy();
			}
		});


		QUnit.test("Should return the translated texts", function (assert) {

			// Arrange
			// this.stub() does not support chaining and it always return the right data
			// even if with wrong or empty parameter passed to it
			var oModel = this.stub();
			oModel.withArgs("i18n").returns(this._oResourceModel);
			var oViewStub = {
				getModel: oModel
			};
			var oControllerStub = {
				getView: this.stub().returns(oViewStub)
			};

			// System under test
			var fnIsolatedFormatter = formatter.statusText.bind(oControllerStub);

			// Assert
			assert.strictEqual(fnIsolatedFormatter("A"), "New", "The long text for status A is correct");

			assert.strictEqual(fnIsolatedFormatter("B"), "In Progress", "The long text for status B is correct");

			assert.strictEqual(fnIsolatedFormatter("C"), "Done", "The long text for status C is correct");

			assert.strictEqual(fnIsolatedFormatter("Foo"), "Foo", "The long text for status Foo is correct");
		});

	}
);
{'fraction_non_alphanumeric': 0.14560810810810812, 'fraction_numerical': 0.00472972972972973, 'mean_word_length': 3.91044776119403, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5836063', 'n_tokens_mistral': 1097, 'n_tokens_neox': 948, 'n_words': 214}